Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Integrate sjuxax's patch

  • Loading branch information...
commit 4f74aecbb31ab5b765dabb828ef48d9f40dfaefa 1 parent a4822fe
Jasper Van der Jeugt authored
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/game/LevelManager.cpp
8 src/game/LevelManager.cpp
View
@@ -59,8 +59,6 @@ namespace jvgs
SketchManager *sketchManager = SketchManager::getInstance();
FPSLogger fps;
-
- float freq_to_update = 1000.0f / 60.0f;
long lastUpdate = timeManager->getTicks();
while(!inputManager->hasQuitEvent()) {
@@ -68,12 +66,12 @@ namespace jvgs
/* 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. */
Please sign in to comment.
Something went wrong with that request. Please try again.