Combining SDL 1.3 and wxWidgets?

I’m interested in using SDL for my game, to do animation, graphics, sound, etc., but use wxWidgets to show dialog boxes: high score name entry, Open File dialog, and general alerts… as well as a Preferences dialog. Plus the level builder will have lots of dialogs.

Problem is, both SDL and wxWidgets use the same event loop. Does anyone know anything about combining both library? Unlike woohoo, who posted in a separate thread a couple days ago about this, I don’t need to allow both SDL and wxWidgets to draw to the same window. Their drawing can be separate. The only problem is events, since both libraries want to “control” events themselves. I want SDL to handle events unless a dialog is showing. While the dialog is active, wxWidgets handles events. Then SDL handles them when the dialog is dismissed.

All I found in a Google search is this, really old, tutorial:

http://code.technoplaza.net/wx-sdl/part1/

Both SDL and wxWidgets have changed a lot since then. I’m using the very latest SDL 1.3 and wxWidgets 2.9.2alpha.

Anyone have any actual experience doing this, or links to tutorials / info?

-Vern

What OS are you on? I ran into a similar issue trying to mix SDL with the
Delphi VCL widget library, so I know how to solve this for Windows, but other
OSes use different messaging models.

The solution for Windows at least is to change your paradigm a bit. For the
level builder especially, your program is not a SDL program; it’s a VCL (or
wxWidgets, in your case) app, and you need to create a widget that allows you to
embed an SDL window into a wxWidgets form. SDL has support for external
windows, which makes this a lot easier. Once you’ve created this, Windows gives
the SDL_Window its own message queue because it has its own window handle, and
it won’t get in the way of your other wxWidgets controls.________________________________
From: vern@actionsoft.com (VernJensen)
To: sdl at lists.libsdl.org
Sent: Thu, March 17, 2011 11:04:51 AM
Subject: [SDL] Combining SDL 1.3 and wxWidgets?

I’m interested in using SDL for my game, to do animation, graphics, sound, etc.,
but use wxWidgets to show dialog boxes: high score name entry, Open File dialog,
and general alerts… as well as a Preferences dialog. Plus the level builder
will have lots of dialogs.

Problem is, both SDL and wxWidgets use the same event loop. Does anyone know
anything about combining both library? Unlike woohoo, who posted in a separate
thread a couple days ago about this, I don’t need to allow both SDL and
wxWidgets to draw to the same window. Their drawing can be separate. The only
problem is events, since both libraries want to “control” events themselves. I
want SDL to handle events unless a dialog is showing. While the dialog is
active, wxWidgets handles events. Then SDL handles them when the dialog is
dismissed.

All I found in a Google search is this, really old, tutorial:

http://code.technoplaza.net/wx-sdl/part1/

Both SDL and wxWidgets have changed a lot since then. I’m using the very latest
SDL 1.3 and wxWidgets 2.9.2alpha.

Anyone have any actual experience doing this, or links to tutorials / info?

-Vern