PDA

View Full Version : Qt4/sdl



alexx
18th March 2007, 21:22
Ave!
How to make a SDLsurface on a QWidget?
heard something with SDL_WINDOWID, but...

Thanks

jpn
19th March 2007, 09:54
Try QxtSdlWidget:

QxtSdlWidget.h (http://libqxt.svn.sourceforge.net/viewvc/libqxt/trunk/src/media/QxtSdlWidget.h?view=markup)
QxtSdlWidget.cpp (http://libqxt.svn.sourceforge.net/viewvc/libqxt/trunk/src/media/QxtSdlWidget.cpp?view=markup)

No-Nonsense
19th March 2007, 12:31
Does this work under Windows? I remember reading somewhere that this approach does not work:

snprintf(windowId, sizeof(windowId), "SDL_WINDOWID=0x%lx", winId());
putenv(windowId);

I would like to try myself, but how do I get the Qxt (Qt extension libraray) compiled under Windows? The documentation on this is somewhat spare.

I checkedout the sources from their SVN repository and then read the "deploy/docs/building.html" but that did not help. What 3rd party libs are needed, where must I copy their sources, etc?

I get the following errors when trying to compile (qmake; make):

makefile:214: *** multiple target patterns. Stop.

Running configure.bat outputs many project messages (autogenerating c++ style includes..., etc.) I have never seen before from any Qt qmake project.

Thanks in advance,
-Jens

No-Nonsense
19th March 2007, 13:14
Ok, got a minimal example running (without the whole Qxt library):


Extract the attached ZIP file to a directory of your choice (I will refer to as project directory from now on).
Get the SDL development libraries for MinGW for Windows from http://www.libsdl.org/download-1.2.php and extract them to the project directory and rename the SDL directory to SDL.
Get the SDL_image development library for MinGW for Windows from http://www.libsdl.org/projects/SDL_image/ and extract the *.dll to "project/SDL/bin". Get the sources from the same site and extract the SDL_image.h to "project/SDL/include".
Run qmake, make.
Copy the SDL.dll, SDL_image.dll, png12.dll from the "SDL/bin" directory to the created executable directory (e.g. "project/release"). Copy the nerd.png there too.


After starting the executable I get a blank black window. Moving it outside the screen and back in reveals the nerd.png image, so it's not working 100% at the moment.

Notes: These are the changes I made to the Qxt files:
QxtSdlWidget.h:
- Commented qxtglobal.h proprocessor inlcude.
- Removed library export macro from class definition.
QxtSdlWidget.cpp:
- Changed SDL preprocessor include to <SDL.h>
MySdlWidget.pro:
- Changed the project file completely.

-Jens

jpn
19th March 2007, 13:44
Yeah, I had my reasons not to paste a link to the homepage but give direct links to the files instead. The library (including it's build system) is still at early development stage and way too immature to be anything usable, really. :)

alexx
21st March 2007, 20:59
Thanks to jpn. will try it. There was no problem with qt3 !!
Thanks to nononsense (i use x11)