Timing

I wish to make it so that, within reason, no matter what the speed of the computer and no matter what the framerate is I can keep my program running at a constant, predictable rate. Did that make sense to anybody? Say that I wish to move forward 0.2 units in a second. I think that I shouls do the following: 0.2/FPS. FPS being the framerate in frames per second. And then I use the answer to that as the amount to move. Do this each cycle through the loop. Am I on the right track?

I think you would be better of using real time (ie milliseconds, or something) instead of a FPS based calculation.

void move_obects(void)
{

  • how long ago (in milliseconds, or whatever) did we last move?
  • move objects (speed * time) units
    }