Qt and Sdl
Posted: Fri Aug 27, 2010 2:01 pm
I would like to use the sdl_ttf library in qt... Any way I could make that ?.. Note: I'm extremely new to qt...
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
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.
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.
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).
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