Skip to content

Instantly share code, notes, and snippets.

@awstanley
Created December 4, 2014 23:53
Show Gist options
  • Save awstanley/ce86755b4de7a057c4fb to your computer and use it in GitHub Desktop.
Save awstanley/ce86755b4de7a057c4fb to your computer and use it in GitHub Desktop.
double delta = 0.0f;
double time_now = glfwGetTime();
double time_last = glfwGetTime();
while(my_running_boolean)
{
time_now = glfwGetTime();
delta = (time_now - time_last);
time_last = time_now;
// Sample object (you want everything to use delta updates)
arbitrary_object->update(delta);
// logic
// render
// poll events (this sample assumes callbacks)
glfwPollEvents();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment