Jump to content
  • Advertisement
Sign in to follow this  
  • entry
    1
  • comments
    9
  • views
    4895

DirectX & Qt

Sign in to follow this  
ShabbaStoney

3696 views

So I finally figured out which API and GUI framework I am going to use for my game.

For GUI I will be using Qt.
The API is DirectX.

I tried OpenGL and decided it wasn't for me. Maybe after this project I will revisit it.

Back to DirectX & Qt :

Had my first problems with this combination tonight, could not get DirectX linked into Qt.

Below I will show how this was accomplished :

I am using Qt Creator as my IDE.

In your .pro file add the following



INCLUDEPATH += D:\DirectX_Feb2010\Include

HEADERS += d3d9.h += d3dx9.h += d3dx9d.h

win32:LIBS += -L"D:\\DirectX_Feb2010\Lib\\x86" -ld3d9 -ld3dx9 -ld3dx9d




For some reason the source tags aren't showing the (plus)= after INCLUDEPATH, HEADERS & win32:LIBS.

That's it! This bit took me about 10 minutes of frustration and it was super easy!

Hopefully the rest will be easier :D
Sign in to follow this  


9 Comments


Recommended Comments

Welcome to the Journals...

So how does QT and DX work, can you overlay QT GUIs over the top of DX rendered scenes? I've never done anything like that before, mostly hand-rolled GUIs

Share this comment


Link to comment
Thankyou evolutional.

The way it works is you inherit from a QWidget, which is basically a base class for all widgets within a GUI. Then you override its paintEngine function to return 0 (yu don't want the GUI to be sending updates over your DirectX widget), OpenGL is a littl different as Qt has built in support for OGL 1.1 (i think), then you have to use extensions through GLee etc...

So, if you're still with me :D, you have your widget you then create a main window which inherits QMainWindow, this is set up for you through Qt Creator. Then theidea is to make your DirectX widget the central widget of the Main Window and hey presto you have a resizable window noe rendering DirectX (well a grey screen at least).

And in the case of the GUI, what I plan to do is set a layout for the Main Window add my widgets to that, and that will draw them over the DIrectX widget and then you have a GUI. :P

Carl

Share this comment


Link to comment
Thankyou evolutional.

The way it works is you inherit from a QWidget, which is basically a base class for all widgets within a GUI. Then you override its paintEngine function to return 0 (yu don't want the GUI to be sending updates over your DirectX widget), OpenGL is a littl different as Qt has built in support for OGL 1.1 (i think), then you have to use extensions through GLee etc...

So, if you're still with me :D, you have your widget you then create a main window which inherits QMainWindow, this is set up for you through Qt Creator. Then theidea is to make your DirectX widget the central widget of the Main Window and hey presto you have a resizable window noe rendering DirectX (well a grey screen at least).

And in the case of the GUI, what I plan to do is set a layout for the Main Window add my widgets to that, and that will draw them over the DIrectX widget and then you have a GUI. :P

Carl

Share this comment


Link to comment
Welcome :) the "+" signs are only hidden in the preview. When the journal entry is posted they show up as usual. This is a bug that has been around for a while :P

Good luck with the project!

Share this comment


Link to comment
oh aye yeah just noticed they do show up, at first i thought it may have needed ecaping, tried everything from \+ to "+" lol, cheers for the info :D

Share this comment


Link to comment
Off topic:
I tried to visit your link you have in your profile.
Avast blocked the page reporting it was infected by iframe-inf.

Share this comment


Link to comment
I'm actually confused about how you got DirectX to work with Qt - since Qt uses GCC by default the DirectX libs will not work for me as they were not compiled using GCC.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!