Post by Nicky Peter Hollyoake on Sept 6, 2008 14:32:38 GMT -5
Any program to do with time post here.
1) Seconds going up.
2) how long your computers been on
3) Real time go into game time
4) Time with a clock!
Anyone got anything else?
- Nicky
UPDATE:
The clock has been updated. The size is also abit bigger if you wanna change the size just change the constant "ClockSize#". The time is now random at start (the checks wasn't nessecery but I thought I'd put them in).
- Nicky
1) Seconds going up.
Dim OldTick# = TickCount()
Dim NewTick#
TextMode(TEXT_BUFFERED)
While TRUE
NewTick# = TickCount()
CLS: Print (NewTick#-OldTick#) / 1000.0
DrawText()
Wend
2) how long your computers been on
Dim MillSec
Dim Seconds
Dim Minutes
Dim Hours
Dim Days
Dim Weeks
TextMode(TEXT_BUFFERED)
ResizeText(50, 30)
While TRUE: CLS
MillSec = (TickCount() )
Seconds = (MillSec / 1000)
Minutes = (Seconds / 60 )
Hours = (Minutes / 60 )
Days = (Hours / 24 )
Weeks = (Days / 7 )
Printr"Your computers been on ..."
Printr
Printr"Weeks:" + Weeks
Printr"Days:" + Days % 7
Printr"Hours:" + Hours % 24
Printr"Minutes:" + Minutes % 60
Printr"Seconds:" + Seconds % 60
Printr"MillSeconds:" + MillSec % 1000
DrawText()
Wend
3) Real time go into game time
Const GameSecs = 45
Const RealTime = 10
Dim OldTick# = TickCount()
Dim NewTick#
Dim Time#
ResizeText(50, 30)
TextMode(TEXT_BUFFERED)
Do
NewTick# = TickCount()
Time# = ((NewTick#-OldTick#) / 1000.0)
CLS
Printr RealTime + " seconds real time (Game shows " + GameSecs + " seconds)"
Printr
Printr"Real time:" + INT(Time#)
Printr"Game time:" + INT(Time#*GameSecs) / RealTime
DrawText()
Loop Until Time# > RealTime
4) Time with a clock!
Const ClockSize# = 4
Dim OldTick# = TickCount()
Dim NewTick#
Dim Hours
Dim Mins
Dim Secs
Dim i
Hours = RND()%24: if Hours > 24 Then Hours = 24 Elseif Hours < 0 Then Hours = 0 Endif
Mins = RND()%60: if Mins > 60 Then Mins = 60 Elseif Mins < 0 Then Mins = 0 Endif
Secs = RND()%60: if Secs > 60 Then Secs = 60 Elseif Secs < 0 Then Secs = 0 Endif
ResizeText(50, 30)
TextMode (TEXT_OVERLAID)
While TRUE: CLS: GLClear(GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT)
'Caculate time
NewTick# = TickCount()
if (NewTick#-OldTick#) / 1000.0 >= 1 Then
OldTick# = TickCount()
Secs = Secs + 1
if Secs >= 60 Then
Secs = 0
Mins = Mins + 1
if Mins >= 60 Then
Mins = 0
Hours = Hours + 1
if Hours >= 24 Then
Hours = 0
Endif
Endif
Endif
Endif
GLLoadidentity()
GLTransLateF(0, 0, - 10) 'Clocks position
'Clocks border
GLBegin (GL_LINE_LOOP)
GLColor3F(1, 1, 1)
For i = 0 To 360
GLVertex2F(Sind(i)*ClockSize#, Cosd(i)*ClockSize#)
Next
GLEnd()
'Clocks lines
GLBegin (GL_LINES)
'Second line
GLColor3F(0, 1, 0)
GLVertex2F(0, 0)
GLVertex2F(Sind(Secs*6)*ClockSize#, Cosd(Secs*6)*ClockSize#)
'Minute line
GLColor3F(0, 0, 1)
GLVertex2F(0, 0)
GLVertex2F(Sind(Mins*6)*ClockSize#, Cosd(Mins*6)*ClockSize#)
'Hour line
GLColor3F(1, 0, 0)
GLVertex2F(0, 0)
GLVertex2F(Sind(Hours*30)*ClockSize#, Cosd(Hours*30)*ClockSize#)
GLEnd()
Color(0, 255, 255)
Print Hours + ":" + Mins + ":" + Secs
if Hours <= 12 Then Printr"AM" Else Printr"PM" Endif
Printr
Color(255, 0, 0): Printr"Red line = Hour"
Color(0, 0, 255): Printr"Blue line = Minute"
Color(0, 255, 0): Printr"Green line = Second"
DrawText()
Swapbuffers()
Wend
Anyone got anything else?
- Nicky
UPDATE:
The clock has been updated. The size is also abit bigger if you wanna change the size just change the constant "ClockSize#". The time is now random at start (the checks wasn't nessecery but I thought I'd put them in).
- Nicky