Skip to content

Commit

Permalink
Merge remote branch 'sjuxax/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Oct 13, 2010
2 parents 891543f + fe19716 commit a4822fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/game/LevelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ namespace jvgs
SketchManager *sketchManager = SketchManager::getInstance();

FPSLogger fps;

float freq_to_update = 1000.0f / 60.0f;

long lastUpdate = timeManager->getTicks();
while(!inputManager->hasQuitEvent()) {
Expand All @@ -69,7 +71,10 @@ namespace jvgs
lastUpdate = ticks;

/* Cap FPS by sleeping a little. */
if(ms <= 1.0f) timeManager->sleep(1);
if(ms <= freq_to_update) {
float wait = freq_to_update - ms;
timeManager->sleep(wait);
}

/* Update the input state. */
inputManager->update(ms);
Expand Down

0 comments on commit a4822fe

Please sign in to comment.