Advertisement

How do incoporate a timer

Started by July 25, 2002 09:29 AM
2 comments, last by Ashanti 22 years, 1 month ago
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
one who knows
What language are you using?
If its C++ are you using Borland C++ Builder, Visual C++ with MFC, Visual C++ with just win32, something else?
Advertisement
I''m programming in C++. (Not with Borland Builder nor Visual C++, I''m using the hard way)

one who knows
one who knows
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

This topic is closed to new replies.

Advertisement