[SDL] Using SDL from within an Windows MFC application

Stephen Anthony stephena at roadrunner.nf.net
Sat Nov 1 07:35:01 PST 2003

First, a little history.  I'm working on Stella, the Atari 2600 
emulator.  As there's no current maintainer for the Windows port, it 
looks like I'm now the maintainer for the Linux *and* Windows ports.  
For the Linux version, I've discontinued the X11 port and went with 
pure SDL.  I'm thinking of doing the same with the Windows port.

The Windows port has a frontend as well as a backend.  The frontend is a 
Windows MFC application which has a file lister, preference settings, 
etc.  The backend is currently written using DirectX, and is quite out 
of date and difficult to work with (it hasn't been updated in over 2 
years).  When a new game is to be emulated (ie, when the user 
double-clicks a game in the file lister), a DirectX window is opened 
and the emulation core takes over.

My question is, can I use SDL to do this backend part instead?  I guess 
my real question is that can the SDL subsystems be opened and closed 
multiple times within the same program (when a new game is launched and 
finished)?  And if using SDL within a Windows application, does it have 
to be initialized as soon as the actual Windows application starts?  Or 
can I do it whenever I want (which would sometimes be not at all)?  If 
this is possible, then I assume that the while SDL is active, it will 
take over all event-handling.  But when SDL exits, will event handling 
return to the MFC application?

Any info on this is appreciated,

More information about the SDL mailing list