Archived

This topic is now archived and is closed to further replies.

How do incoporate a timer

This topic is 5618 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Word, I''m working on my very first game and I want to know how to incoporate a timer (I''m using DirectDraw, its a 2d game) so as to have events occur within certain time intervals (ex: after every two second a stone rolls accross the screen). one who knows

Share this post


Link to post
Share on other sites
you can use timeGetTime function. when your app starts, save the returned value. then each frame call it again and check the difference. if the difference is more than two seconds, start rolling the stone.

if you want more accurate timing (timeGetTime is accurate up to 1 ms), use QueryPerformanceCounter.

---
Come to #directxdev IRC channel on AfterNET

Share this post


Link to post
Share on other sites