Jump to content

Timing things in Ultra


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

Is there a need for something like this in Ultra or is the game loop frequency manged by the engine as indicated by world::Update()'s frequency parameter?

uint64_t time_span = 1000;//ms
uint64_t time_interval = 100;//ms
uint64_t start_time = Millisecs();
float range = 90.0f;
float inc = range / (float)(time_span / time_interval);

//loop

auto result = 0.0f;
uint64_t current_time = Millisecs();
if (current_time >= start_time + time_interval) {
	start_time = current_time;

	result += inc;//Should be approx 90.0f after a second
}

 

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.

 Share

×
×
  • Create New...