Computer Science Canada Timer |
Author: | WhatAmIDoing [ Tue Apr 20, 2004 1:34 pm ] |
Post subject: | Timer |
i was bored and trying to make a good looking timer setscreen ("graphics:200;100") var Min, Sec, Hrs, MSec : int := 0 colorback (black) cls color (brightgreen) loop Sec += 1 if Sec = 60 then Sec := 0 Min += 1 end if if Min = 60 then Min := 0 Hrs += 1 end if locate (1, 1) put Hrs, " HRS" locate (1, 10) put Min, " MIN" locate (1, 20) put Sec, " SEC" delay(1000) end loop |
Author: | Delos [ Tue Apr 20, 2004 4:45 pm ] |
Post subject: | |
Delays are bad. They are bad because there are never working. Always, never working. Why? Because they are bad, always. And different! On all computers, so always, never. Bad and bad. "Good!" they say, "We are" they say, then they jump at me and beat me down with sticks. And they are bad like techno with bagpipes. Always! Yeah, try Time.Elapsed instead. And for those who do not recognize the speach impediment pattern above, it is the classic Depressed Persian Tow Truck Man, from Mad TV. |
Author: | Tony [ Tue Apr 20, 2004 6:48 pm ] |
Post subject: | |
Delos is right. You shouldn't be using delays. And when you are (to slow game down for example) - don't hardcode them, use variables instead and adjust the delay based on CPU speed |
Author: | Delos [ Tue Apr 20, 2004 6:49 pm ] |
Post subject: | |
tony wrote: ...and adjust the delay based on CPU speed...
Tony, is there any way of doing this without having the User enter their CPU speed manually??? |
Author: | Tony [ Tue Apr 20, 2004 7:08 pm ] |
Post subject: | |
well I was refering to FPS implemination |
Author: | WhatAmIDoing [ Wed Apr 21, 2004 7:52 am ] |
Post subject: | |
ok i'll try to implement that into but i still not completly sure of how it works. any way thanks for the tip. |