Timer events

My prior post has been stuck in moderator queue for a week or two -
must’ve sent from the wrong address. Here’s a crappy, dilluted,
not-as-clearly-thought-out version of that post.

With SDL 2.0, would it be possible to get a timer events API in addition
to (or instead of) the callback API? I’m envisioning something pretty
simple here:

/* list of timer IDs… maybe 8? */
typedef enum {
SDL_TIMER1,
SDL_TIMER2,

SDL_TIMERN
} SDL_TimerID;

/* a timer event in the evnt enum */
SDL_TIMER = whatever

/* a timer event structure
typedef struct {
Uint8 type;
SDL_TimerID timer;
double last; /* the last time the event fired, or 0 if this is
the first time /
double time; /
the exact time the event fired, which might be
a little in the past from event dispatch overhead */
} SDL_TimerEvent;

/* set events

  • timer: timer to set
  • interval: secs between firing; if zero, disable timer
  • repeat: if non-zero, repeat event every interval; otherwise,
    just once
    */
    void SDL_SetTimerEvent(SDL_TimerID timer, double interval, int repeat);–
    Sean Middleditch <@Sean_Middleditch>