[SDL] Help with timers needed!
Billi Bot
hr_hristov at hotmail.com
Sat May 10 01:42:03 PDT 2003
Could somebody be so nice and help me with SDL's timers.
I cannot figure out how to create a timer (SDL_AddTimer, SDL_SetTimer)
and a callback function. Well, maybe more exactly my problem is that I
cannot understand how to make a callback function with parameters.
Well I want to be able to call that the timer calls the callback
function and that I manually call it under certain circumstances (like
the user presses a key). Is this possible at all?
I'm trying to do something like (it should switch something on and off
on a regular interval).
// the callback function
SDL_TimerCallback Switch( bool *on )
{
}
...
// the timer
timer = AddTimer( 1000, Switch(...
This is the description of SDL_AddTimer from the docs SDL_AddTimer --
Add a timer which will call a callback after the specified number of
milliseconds has elapsed.
Synopsis
#include "SDL.h"
SDL_TimerID SDL_AddTimer(Uint32 interval,
SDL_NewTimerCallback callback, void *param);
Callback
/* type definition for the "new"
timer callback function */
typedef Uint32 (*SDL_NewTimerCallback)
(Uint32 interval, void *param);
Thank you very much for any working example and explanation of
callbacks!!!
More information about the SDL
mailing list