Jump to content
  • Advertisement
Sign in to follow this  
Bede

Allegro Timer

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

Hi, I'm currently building a small game using Allegro and I want to implement a feature that tells the user how long it has taken them to complete the game. Can anyone point me in the right direction for this? Basically, what I'm wanting is that when the game starts, the timer also starts and your increasing time is displayed down the bottom of the screen. When the user hits Escape, I want the timer to stop. My two main questions are: 1) How would I start/stop the timer and 2) How would I display it (using the textout_ex function maybe??)? Any help would be very much appreciated. Thanks, Bede.

Share this post


Link to post
Share on other sites
Advertisement
I would use the timer functions to just increment a volatile variable 60 times a minute and count the seconds out. Remember and reassign the variable for a pause. Display with textprintf_ex, I'd say. Just my 2 cents.

Share this post


Link to post
Share on other sites
23yrold3yrold - Thank you very much. I have managed to find an example that implements what you suggested and it now appears to be working fine.

Thanks for your help,

Bede.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!