Sign in to follow this  
Bede

Allegro Timer

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this