[SDL] Synchronization and fps - mental confusion

Rasmus Neckelmann neckelmann at gmail.com
Wed Sep 27 23:35:08 PDT 2006


On 9/27/06, Salvatore Di Fazio <salvatore.difazio at gmail.com> wrote:
> How can I move all my sprite in the same time?

Just make sure that you're only delaying in the WaitFrame() function.

> How can I calculate the frame rate?

In this case Sam uses a fixed frame rate, which is probably good
enough for most simple games. Try with #define'ing FRAMES_PER_SEC to
25 or something like that.
The downside to this solution is that when the computer is too slow to
draw 25 frames per second, the gameplay will simply run slower.

A better way to handle this is by doing something like described in
this short article: http://www.gaffer.org/fix-your-timestep/.

-- 
Cheers,
Rasmus Neckelmann




More information about the SDL mailing list