SDL and QT

Hello All,

I am very new to this list and also to SDL so I hope that someone can
clear up the confusion for me.

I am working on a few projects which involve multimedia as well as
basic widgets.

In particular, I am a little confused about what SDL is exactly for
as opposed to QT libraries and could they be used together? If not,
the dows SDL support the standard Windows widgets that I can use in
my project.

Thanks for any help you that you can give me.
Lonnie

I am working on a few projects which involve multimedia as well as
basic widgets.

In particular, I am a little confused about what SDL is exactly for
as opposed to QT libraries and could they be used together? If not,
the dows SDL support the standard Windows widgets that I can use in
my project.

SDL gives you abstractions over multimedia things like video and sound and
input, etc.

SDL is to DirectX what Qt is to MFC. They aren’t really interchangable.

–ryan.

Hi all,

I’m trying to use SDL to draw on QT widgets (instead of QPainter). So
far i’ve only tried with QT3 for linux.

The intention is to draw some stuff to several alpha-blended surfaces,
and then blit them (with transparency) to the screen on demand (ie when
Widget::paintEvent() is called).

I’ve had mixed success, mostly from the fact that I’m not very
experienced with SDL and so on.

I have first tried using the SDL_WINDOWID and winid() hack, which works
to some extent when there is only one of these QT-SDL widgets in a window.

In the case of just one sdl-surface in a window, each time the window
loses focus the display flickers (using mouse-focus, that means just
waving the mouse in and out of the window). I am guessing that its
caused by setting the videomode each time the widget paints.

When I try adding two of these special widgets into a qt window, only
one gets drawn, for some reason the first widget is drawn on the second
widget’s location.

I was under the (naive?) impression that i could set the WINDOWID each
time before setting the video mode, and then i could draw to that window
until i set the videomode again. Obviously not?

Here is a snippet of the code, I’m not sure how much to paste on this
mailing list. I have a source tarball ready to go for anyone who
requests it. (i have a bad feeling this email is already too long).

Note I’m using the sge library, as it has the primitives i want.

I construct two surfaces “buffer” and “circle” in the widget
constructor. That goes fine. The key part of the code is this:

void QSDL::paintEvent( QPaintEvent* event )
{
QString ids;
setenv(“SDL_WINDOWID”, ids.setNum(winId()), 1);

int w = event->rect().width();
int h = event->rect().height();

SDL_Surface *screen;
screen = SDL_SetVideoMode( w, h, 16, SDL_SWSURFACE );

SDL_BlitSurface(buffer,NULL, screen,NULL);

SDL_UpdateRect( screen, 0, 0, w, h );

}

Thanks
Paul

Hello:
Some one Can tell me ,When I use the QT,how can I use the SDL together!!?
thank you
-------------- next part --------------
A non-text attachment was scrubbed…
Name: daixf.vcf
Type: text/x-vcard
Size: 703 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040812/dc43720a/attachment.vcf

Maybe this example will help:
http://nehe.gamedev.net/data/lessons/qt_cpp/lesson02.tar.gz

  • Donny VisznekiOn Aug 11, 2004, at 9:29 PM, ???(xiaofei dai) wrote:

Hello:
Some one Can tell me ,When I use the QT,how can I use the SDL
together!!?
thank you
<daixf.vcf>_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl