Page 1 of 1

Qt and Sdl

Posted: Fri Aug 27, 2010 2:01 pm
by adikid89
I would like to use the sdl_ttf library in qt... Any way I could make that ?.. Note: I'm extremely new to qt...

Re: Qt and Sdl

Posted: Fri Aug 27, 2010 2:11 pm
by mv2112
You would have to convert an SDL_surface to a QPixmap, why would you want to use SDL_ttf though anyway? Qt has QFont and functions to print text.

Re: Qt and Sdl

Posted: Fri Aug 27, 2010 2:15 pm
by adikid89
mv2112 wrote:You would have to convert an SDL_surface to a QPixmap, why would you want to use SDL_ttf though anyway? Qt has QFont and functions to print text.
I need to have access to the pixel map of the font... Using sdl_ttf it returned a sdl_surface.. so i had access to the pixels. Does QFont provide something similar ?

Re: Qt and Sdl

Posted: Fri Aug 27, 2010 2:22 pm
by Arce
I'm sure it does. Try looking into "QPixMap," "QPainter," and maybe read the general "QGraphicsView" for details about each.

Re: Qt and Sdl

Posted: Fri Aug 27, 2010 2:24 pm
by mv2112
adikid89 wrote:
mv2112 wrote:You would have to convert an SDL_surface to a QPixmap, why would you want to use SDL_ttf though anyway? Qt has QFont and functions to print text.
I need to have access to the pixel map of the font... Using sdl_ttf it returned a sdl_surface.. so i had access to the pixels. Does QFont provide something similar ?
I actually do think you can integrate SDL with Qt with a rendering context like openGL, but i cant find any good info on it :(

Re: Qt and Sdl

Posted: Mon Aug 30, 2010 4:43 pm
by Falco Girgis
Are you seriously using SDL in QT to begin with? Seriously?

Re: Qt and Sdl

Posted: Mon Aug 30, 2010 4:53 pm
by WSPSNIPER
ya, Qt provides everything you will need, just look into it. there is QImage and QPixmap for images... just check them out you DONT need sdl

Re: Qt and Sdl

Posted: Mon Aug 30, 2010 5:09 pm
by Falco Girgis
That's what I'm saying. If you use QT, there would be no real reason for SDL. You're just embedding another huge dependency into an already gigantic library (that already has everything you need).

Re: Qt and Sdl

Posted: Tue Aug 31, 2010 5:33 am
by MrDeathNote
GyroVorbis wrote:That's what I'm saying. If you use QT, there would be no real reason for SDL. You're just embedding another huge dependency into an already gigantic library (that already has everything you need).
Exactly, plus Qt integrating with openGL is amazing. And if you dont want to jump right into ogl you can always use QPainter which is very powerful and has it's back end in ogl.

Re: Qt and Sdl

Posted: Tue Aug 31, 2010 8:14 am
by adikid89
I googled a bit and it seems i can draw text using Qpainter on a Qimage. And I can access the pixel data from a QImage. I'm still not sure what I'm doing though... I don't know how to use the QPainter on a QImage, and I want the QImage to resize so that the text I write will fit properly. Anyone got a idea on that? QT is hard :(... awesome.. but complicated :(

Re: Qt and Sdl

Posted: Tue Aug 31, 2010 10:48 am
by WSPSNIPER
adikid89 wrote:I googled a bit and it seems i can draw text using Qpainter on a Qimage. And I can access the pixel data from a QImage. I'm still not sure what I'm doing though... I don't know how to use the QPainter on a QImage, and I want the QImage to resize so that the text I write will fit properly. Anyone got a idea on that? QT is hard :(... awesome.. but complicated :(
there are several ways to do this, personally i dont use QPainter... i just use straight OGL because i find it more my style. but look into QGraphicsView and QGraphicsScene and i think you will find what you are looking for... they have a lot of functions, QGraphicsView has stuff like drawTiledPixmap and i think some draw text function and the scene would allow you to add the text to a scene, resizing takes more time but if you dont have as many items it dosent matter. if you use scene, which you need to get a graphics view running ( view.SetScene(new QGraphicsScene) is all it takes ) make sure to lookinto QGraphicsItem as well