[SDL] animations etc
kylotan at kylotan.eidosnet.co.uk
Tue Sep 17 06:33:01 PDT 2002
screwtape at froup.com wrote:
> You have an event loop that you'll be iterating through quite
> frequently, and you have a function to get a number which increases at
> a constant rate in real time (as opposed to CPU time).
> All you need is a sorted list of happenings and specified times -
> for example, when you want a bomb to explode five seconds from now,
> add a new happening to the list with the time 'SDL_GetTicks() + 5000'
> (because SDL_GetTicks measures 1000 ticks per second).
This can be awkward if you allow the player to pause the game. In such a
situation, you will need to do something like time how long the game is
paused (and add that to all the event times when the player unpauses) or
time the events in frames instead.
More information about the SDL