Jump to content
  • Advertisement

Archived

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

cyam95

How to create timer

This topic is 6194 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

I want to create a timer that will start when user press any key and will stop when it equal to 0 or when it reach the specific time. Can I create the timer using sytem time (Windows time) and how do I read it in GLUT. Can anyone help me?

Share this post


Link to post
Share on other sites
Advertisement
Under windows, if you want a real good precision with your timer.

Use QueryPerformanceFrequency to get the frequency of the timer and QueryPerformanceCounter to get the value of the timer.

Call each frame QueryPerformancCounter to know the new value and subtract it with the precedent value to get the delta time.

Share this post


Link to post
Share on other sites
see glutTimerFunc (but perhaps u might wanna have a look sdl for more accurate timing stuff)
also QueryPerformanceFrequency is the slowest method of getting the time in win32

http://uk.geocities.com/sloppyturds/gotterdammerung.html

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!