+ if(elapsed_time > 0.025){
+ elapsed_time = 0.025;
+ }
+
+ // fps regualting code
+ const int wantedFps= 60; // set to 60 by now
+ 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);
+ }
+
+ }
+ fps_nextframe_ticks = SDL_GetTicks() + (1000 / wantedFps); // sets the ticks that must have elapsed
+ // in order for the next frame to start.
+