[SDL] Events in a multi-threaded game

Thomas Lecomte deather.dede at gmail.com
Wed Jun 15 06:08:11 PDT 2005

I've started programming a 2D game using SDL. I decided to use a separate 
thread to read events from SDL, using SDL_WaitEvent in a while loop. This 
worked great under all Unix based box, but under Win32 the window isn't 
respoding and I can't get the mouse events, for example.
After searching on google I found some interesting things:
	- First I've read that I had to catch events in the same thread that the one 
who set up the video mode. The which one who call SDL_SetVideoMode() or 
SDL_Init() ? It's not very clear in the documentation, and some person said 
that it's in fact the thread which call SDL_Init().
	- I read also that I can catch events in another thread but I had to run 
SDL_PumpEvents() in the main thread. I tried this way but I got some Xlib async 
errors :-(

Well I would like to know what's the correct way to do this. I will add this to 
the Wiki documentation of SDL, it will be helpful for newbis like me ;-)
Thanks. :-)
Thomas Lecomte
deather.dede at gmail.com

More information about the SDL mailing list