PDA

Click to See Complete Forum and Search --> : Timer


Vuen
Oct 9th, 2000, 08:25 PM
HELP! I need a timer that works better than the simple Timer, and I need it to be the SAME SPEED on ALL computers. I use DirectDraw in my game in case DX has one. I would like it to be able to give return any number of times per second up to at least 50.

Sophtware
Oct 9th, 2000, 10:59 PM
It werks on every ms comp...well mostly all of them..
and it is better than the bland timer.


Heheh look at me ..i sound like a salesman for M$ :p

Fox
Oct 10th, 2000, 12:12 AM
(GetTickCount returns the number of miliseconds windows is running, however, you can use it instead of your timer if you wait for 1s / 50 frames = 20ms each frame:


Dim Temp as Long

While Active
'Start frame timer
Temp = GetTickCount

'Your main loop
'Get input, animate,...
'Draw stuff to buffer

While Temp + 20 > GetTickCount
'Do nothing while waiting, you could put DoEvents here...
Wend

'Flip to screen
Wend


This will slow down the main loop to 50 cycles / second.

Hope this helps ;))