[SDL] 1.3 Event source addition

Olivier Delannoy olivier.delannoy at gmail.com
Thu Jun 29 05:30:14 PDT 2006


I like the event loop of SDL and my only problem with 1.2 series is
that the Event subsystem is completly hidden and close. There is no
way to extends this part of the library that I know. It would really
interesting to be able to register new event source that are triggered
by SDL automatically.


Supposing I am using a networking library like SDL_Net I need to
construct my program the following


begin event loop

   while there some SDL event do
     if event is a mouse event ...
     if event is a keyboard event ...
     ...
   end

   while there some Network event do
      ...
    end

    ...
end


It would be cool to be able to register our own source of event using
an API call
similar to

struct SDLEventSource
{
   void (*pushEvents)(void* userdata);
   void* userdata;
};

SDL_EventRegisterSource(SDL_EventSource* source);

SDL_EventUnregisterSource(SDL_EventSource* source);


With such call we can integrate in a consistent way user defined event.




More information about the SDL mailing list