Jump to content

Updating elapsed time efficiently


scunliffe
 Share

Recommended Posts

In the puzzle game I'm working on I'd like to maintain an elapsed time clock shown to the user indicating how long they have been working on a particular puzzle.

e.g. 00:13:45 (thirteen minutes and fourty-five seconds)

I have no issues with the math to display the time, nor the APIs to render the text... my question is how to do this effectively?

e.g. I currently wired this up to run in my main update() loop however this therefore tries to run as frequently as it can but I only need it to run once per 1,000ms or in 1 frame (if running at 60fps)

Is there an API to only call something a "max" of once per "time period"?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...