Qt and Sdl
Moderator: Coders of Rage
- adikid89
- 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
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
==============================================================
==============================================================
- mv2112
- 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
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.
- adikid89
- 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
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 ?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.
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
==============================================================
Re: Qt and Sdl
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
- mv2112
- 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
I actually do think you can integrate SDL with Qt with a rendering context like openGL, but i cant find any good info on itadikid89 wrote: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 ?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.
- Falco Girgis
- 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
Are you seriously using SDL in QT to begin with? Seriously?
- WSPSNIPER
- 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
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
- Falco Girgis
- 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
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).
- MrDeathNote
- 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
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.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).
http://www.youtube.com/user/MrDeathNote1988
"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
"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
- adikid89
- 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
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
==============================================================
==============================================================
- WSPSNIPER
- 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
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 welladikid89 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