X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame_session.cpp;h=6aae47e09f26f9f54bd0621823851cdce2d00bed;hb=eba5f4b45f92cb19a09fbac1a478648062480adb;hp=662371f2714d2c9033f9188e514c855d18991713;hpb=be3627a9c6fc5bb27e5297da512d59a7eb4033a2;p=supertux.git diff --git a/src/game_session.cpp b/src/game_session.cpp index 662371f27..6aae47e09 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -486,10 +486,10 @@ GameSession::run() while (fps_nextframe_ticks > SDL_GetTicks()){ /* just wait */ // If we really have to wait long, then do an imprecise SDL_Delay() - if (fps_nextframe_ticks - SDL_GetTicks() > 15){ - SDL_Delay(5); - } - + Uint32 ticks = SDL_GetTicks(); + if (fps_nextframe_ticks - ticks > 15) { + SDL_Delay((Uint32) (fps_nextframe_ticks - ticks)); + } } float diff = SDL_GetTicks() - fps_nextframe_ticks; if (diff > 5.0)