Permalink
Browse files

Integrate sjuxax's patch

  • Loading branch information...
1 parent a4822fe commit 4f74aecbb31ab5b765dabb828ef48d9f40dfaefa @jaspervdj committed Oct 13, 2010
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/game/LevelManager.cpp
View
8 src/game/LevelManager.cpp
@@ -59,21 +59,19 @@ namespace jvgs
SketchManager *sketchManager = SketchManager::getInstance();
FPSLogger fps;
-
- float freq_to_update = 1000.0f / 60.0f;
long lastUpdate = timeManager->getTicks();
while(!inputManager->hasQuitEvent()) {
/* Calculate the ticks that have passed. */
long ticks = timeManager->getTicks();
float ms = (float)(ticks - lastUpdate);
+ const float treshold = 1000.0f / 60.0f;
lastUpdate = ticks;
/* Cap FPS by sleeping a little. */
- if(ms <= freq_to_update) {
- float wait = freq_to_update - ms;
- timeManager->sleep(wait);
+ if(ms <= treshold) {
+ timeManager->sleep(treshold - ms);
}
/* Update the input state. */

0 comments on commit 4f74aec

Please sign in to comment.