[SDL] How to have sevral SDL windows in ONE X11/QT apps

Peter Strempel zotan at web.de
Sun Nov 16 00:42:24 PST 2003


That topic was discussed a month ago or so on this list, check the archive.

 > My first question: is is possible to do this?

Some guy posted example code how to do several SDL windows with the FLTK 
toolkit. I managed to adjust the code for wxWindows (my app does several 
windows with each one SDL surface). I guess it should be possible to do 
the same with Qt.

> My second: if yes, what should i do?

Check the above mentioned FLTK example in the archive.

In short, you do not embed a SDL_Surface via the SDL_WINDOWID hack but 
simply paint your stuff on a "hidden" SDL_Surface in memory and let your 
GUI toolkit draw the pixel data from the surface into its own window. Of 
course this will slow things down as there is an extra step involved as 
the SDL_Surface is not directly rendered, but this should be minimal. In 
wxWindows it works quite smooth, though, as one can create a bitmap from 
memory (the SDL surface pixel data) and render that bitmap in a window, 
it doesn't even need to copy pixels as the original SDL pixel data is 
used, but this might not be possible with all GUI toolkits. I suppose 
this should be doable with Qt in a smiliar approach, too. I don't know 
Qt well enough to tell you details on how exactly to do this. Check the 
API doc.

  Peter





More information about the SDL mailing list