Qt Creator and sfml

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
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++

Qt Creator and sfml

Post by WSPSNIPER »

ok i dont know if any of you do this but im using sfml with qt, with qt creator. every thing works fine except loading images for the map window, one of the windows. i have a Main Window which has the menu buttons and stuff and i have 2 sfml windows... using the sfml tutorial base class and inheriting. one tile window and one map window. for loading tile sheets im using QFileDialog::getOpenFileName()(syntax check) then i loads for the tile window but not for the other window. how i load the sprites is when i create a new map i call

Code: Select all


sprite[l][x][y].SetImage(m_imageManager->GetImage(TileSheet::GetInst()->GetImageDir().toStdString()));

now the tiles show up at the right size and everything which tells me that it is loading somthing but why is it now showing up. if you want code just tell me what you want to see becuase there is a ton of it ;)
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Qt Creator and sfml

Post by Ginto8 »

ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
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 Creator and sfml

Post by WSPSNIPER »

Ginto8 wrote:ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!

that was what i was going to do but i just stated and sfml had tutorials on getting it to work so i thought i would give it a shot.

ill probably go opengl but it would be convenient to get sfml to work with it becuase im almost finished with it.
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 Creator and sfml

Post by MrDeathNote »

You don't have to straight into OpenGL. You can use QPainter if you want, it's much easier and it's back end is OpenGL. So if you're not comfortable with OpenGL go with that untill you get on your feet.
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
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 Creator and sfml

Post by WSPSNIPER »

MrDeathNote wrote:You don't have to straight into OpenGL. You can use QPainter if you want, it's much easier and it's back end is OpenGL. So if you're not comfortable with OpenGL go with that untill you get on your feet.
thanks, im comfortable with opengl but i really dont want to handle images and stuff... i guess i can try qtpainter. one thing i saw was the QBitmap did not have a clipping function so i would have to make that.
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: Qt Creator and sfml

Post by RyanPridgeon »

Ginto8 wrote:ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
Using raw OpenGL would make image loading HARDER, not easier
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
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 Creator and sfml

Post by MrDeathNote »

RyanPridgeon wrote:
Ginto8 wrote:ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
Using raw OpenGL would make image loading HARDER, not easier
Qt actually makes loading OpenGL textures very simple.

Code: Select all

    //Local images
    QImage t, b;

    //Load the image
    if (!b.load(file))
    {
      ;//Fill in error stuff
    }

    //Convert image to a GLuint
    t = QGLWidget::convertToGLFormat(b);
    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits());
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
where texture is a GLuint.

This is just an example of course but it's that easy :)
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
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Qt Creator and sfml

Post by eatcomics »

Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Image
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 Creator and sfml

Post by MrDeathNote »

eatcomics wrote:Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Lol yea it's the shit.
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
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 Creator and sfml

Post by WSPSNIPER »

MrDeathNote wrote:
eatcomics wrote:Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Lol yea it's the shit.

sweet, i dident know it was that easy. good ill go opengl
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 Creator and sfml

Post by MrDeathNote »

WSPSNIPER wrote:
MrDeathNote wrote:
eatcomics wrote:Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Lol yea it's the shit.

sweet, i dident know it was that easy. good ill go opengl
Well thats the idea of it, bare in mind that thats off the top of my head pretty much and its untested.
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
Post Reply