Qt and Sdl

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
adikid89
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 94
Joined: Tue Apr 27, 2010 6:59 am
Current Project: small tiny-mini projects
Favorite Gaming Platforms: PC I guess...
Programming Language of Choice: c++

Qt and Sdl

Post 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...
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
Image
User avatar
mv2112
Chaos Rift Junior
Chaos Rift Junior
Posts: 240
Joined: Sat Feb 20, 2010 4:15 am
Current Project: Java Tower Defence Game
Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
Programming Language of Choice: C/++, Java
Location: /usr/home/mv2112
Contact:

Re: Qt and Sdl

Post 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.
User avatar
adikid89
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 94
Joined: Tue Apr 27, 2010 6:59 am
Current Project: small tiny-mini projects
Favorite Gaming Platforms: PC I guess...
Programming Language of Choice: c++

Re: Qt and Sdl

Post 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 ?
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
Image
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: Qt and Sdl

Post by Arce »

I'm sure it does. Try looking into "QPixMap," "QPainter," and maybe read the general "QGraphicsView" for details about each.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
mv2112
Chaos Rift Junior
Chaos Rift Junior
Posts: 240
Joined: Sat Feb 20, 2010 4:15 am
Current Project: Java Tower Defence Game
Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
Programming Language of Choice: C/++, Java
Location: /usr/home/mv2112
Contact:

Re: Qt and Sdl

Post 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 :(
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Qt and Sdl

Post by Falco Girgis »

Are you seriously using SDL in QT to begin with? Seriously?
User avatar
WSPSNIPER
Chaos Rift Regular
Chaos Rift Regular
Posts: 145
Joined: Sun Jan 03, 2010 6:19 pm
Current Project: top down shooter
Favorite Gaming Platforms: ps3
Programming Language of Choice: c++

Re: Qt and Sdl

Post 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
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Qt and Sdl

Post 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).
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Qt and Sdl

Post 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.
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
User avatar
adikid89
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 94
Joined: Tue Apr 27, 2010 6:59 am
Current Project: small tiny-mini projects
Favorite Gaming Platforms: PC I guess...
Programming Language of Choice: c++

Re: Qt and Sdl

Post 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 :(
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
Image
User avatar
WSPSNIPER
Chaos Rift Regular
Chaos Rift Regular
Posts: 145
Joined: Sun Jan 03, 2010 6:19 pm
Current Project: top down shooter
Favorite Gaming Platforms: ps3
Programming Language of Choice: c++

Re: Qt and Sdl

Post 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
Post Reply