Jump to content
  • Advertisement

Archived

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

Ashanti

How do incoporate a timer

This topic is 5902 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
Advertisement
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?

Share this post


Link to post
Share on other sites
I''m programming in C++. (Not with Borland Builder nor Visual C++, I''m using the hard way)

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!