Skip to content

Instantly share code, notes, and snippets.

@bendem
Created January 28, 2014 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bendem/8676430 to your computer and use it in GitHub Desktop.
Save bendem/8676430 to your computer and use it in GitHub Desktop.
How a game loop is filled...

How a game loop is filled...

final int FPS = 60;
// 1 secondes divisée en 60 frames;
final long timeForAFrame = 1 000 000 000 / 60;

long beginTime = CurrentTime();

doSomeStuff();

long elapsedTime = CurrentTime();
long remainingTime = timeForAFrame - elapsedTime;
sleep(remaining);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment