[SDL] Framerate independence?

Stefan Hendriks stefanhen83 at gmail.com
Tue Mar 27 04:18:45 PDT 2007


Why does one need a 'fixed' fps anyway? Afaik you want a fixed
game-flow , independant of the fps.

Drawing stuff etc, thats FPS. Keep a timer (use interupt handler, i
think SDL_Timer can do that) , and update your cycles each frame.


void gameloop() {

while (gameruns) {
  handle_logic();
  handle_drawing();
}

}

where handle_logic does.


void handle_logic() {
 while (timer > 0) {
   updatelogicbytickonsomeevent/unit. etc.
   timer--;
}

}


Would be sufficient?


More information about the SDL mailing list