__ (00) - Vote Cthulhu for president. "The stars are right; /||\ why vote for the lesser of two evils?"
Mindflayers: Make sexy brain eating tentacle love - Not war!
Constant speed in games
Solving this problem for a modular program is simple; another division just has to be made, has already been made most likely. Seperating the main game loop into two parts, the logic loop, and the graphics loop. Running the logic loop a set number of times a second, and the graphics loop whenever possible, but no more than once after a logic loop. (I mean really, what is the point?)
to wit:int play_game() { int actual_game_time = 0, okay_to_draw = TRUE; while(!done) { while (actual_game_time < target_game_time) { logic_loop(); actual_game_time++; ok_to_draw = TRUE; } if (ok_to_draw) { graphics_loop(); ok_to_draw = FALSE; } } return 0; }