[SDL] sdl on win32
skaller at users.sourceforge.net
Tue Feb 7 10:13:28 PST 2006
Hi, sorry for newbie question.. also sorry for any inaccuracies
here, I'm mailing from Linux on dual boot system.
I'm trying to get SDL running on Win32 (XP)
using *command line* versions of MSVC++ (Visual Studio 2003).
The code being executed has two properties (at present):
1. It lives in a DLL. The mainline knows nothing about SDL.
It isn't linked with SDL.lib or SDLmain.lib.
The effect is that SDLmain stuff is not executed.
Apps still sort of run anyhow .. SDL_main doesn't
seem to do anything important except possibly this:
[It also inits SDL without parachutes ..]
The system RTL includes some SDL aware code though (see below).
2. At present, I'm reading events in a thread. This should
work, and does on Linux. The technique is the same as
for SDL_audio. SDL_EventWait is used to block the thread.
A mutex is used to lock out the thread from calling the
SDL_EventWait whilst doing nasty stuff like graphics. In case
the thread is already blocked inside SDL_EventWait,
a dummy event is posted to push it out.
The effect is: the code seems to sort of run, but the screen (window)
tends not to display anything. A mouse click makes it go white.
Some OpenGL apps sometimes work, even respond to the keyboard,
but the mouse messes them up.
When I replaced the SDL_Event source with one inside the main
thread, the display worked fine with SDL only app.
However the app didn't work correctly since doing
this blocked out other asynchronous event sources,
in this case a timer. Hard to tell if the OpenGL apps
would work (since they're driven by a timer which can't
operate when the system is blocked)
Any help appreciated here!
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
More information about the SDL