Reputation: 33
I am just getting started with Qt and cryengine, and I want to run a Qt GUI application inside cryengine. I am programming with Visual Studio 2010 with the Qt add-on. I have both the cryengine source code and a Qt GUI's source code that I have made compiled in the same solution. However, I am unsure of how to actually run a Qt GUI inside of the code.
Can anyone give me an example of a piece of code I could use to run a Qt GUI? And just to be clear, my Qt project includes a main.cpp, a header, another .cpp, and a .ui file. Can I use any of these to run a GUI or do I need to run the actual .exe that is made when compiling?
Thanks
Upvotes: 0
Views: 1018
Reputation: 3
To be honest, I have no idea, how Qt works; But assuming Qt is able to render an image you could exploit that to do it in a slightly hacky way:
You could even emulate the 3D functionality of Scaleform using that approach:
You should be able to do all the CryEngine-related inside the GameDll - but sadly I can't give you code snippets right now (might do that later). Also there is one big downside to this approach: you would have to implement the entire UI interaction yourself.
Otherwise if you want the Qt UI to really be above the CryEngine and have the 'full' CryEngine source code, you could host the CryEngine inside a Qt application. For that approach you would have to create a Qt widget to act as a container for the CryEngine and force that widget to have a native handle ( you might want to have a look at the following link for that: Force QWidget Child to have its own Window Handle ). You then use that handle when intialising the engine ( you might want to have a look at the PC Launcher code as well as the game startup related code inside the GameDll for that ). With that in place you can design the rest of the UI to be above the engine widget (simply adding elements without adding them to the layout could be enough for that - even though you would have to position them by hand)
There might still be a better approach, by really 'hosting' Qt inside CryEngine, but I have no idea, how one would do that.
Upvotes: 0