History: MyGUI quickstart
Preview of version: 29
This is a quick start for MyGUI 3.0+. If you want to use an earlier version of MyGUI, use this page.
Copy the MyGUI_Media folder from the downloaded package (or from svn) and add the path to it in your resources.cfg.
Compile MyGUI and put MyGUIEngine(_d).dll near the executable file and add MyGUIEngine(_d).lib as an additional dependency.
You will also need to compile MyGUI.OgrePlatform as an interface for the MyGUI library to the Ogre rendering engine, and add MyGUI.OgrePlatform(_d).lib as an additional dependency.
If MyGUI was built as a static library, freetype####(_d).lib is also required (#### - your freetype version).
Code
includes:
You need to add these to the included folders: - path_to_MyGUI/MyGUIEngine/include and path_to_MyGUI/Platforms/Ogre/OgrePlatform/include, and add to your code the following includes:
#include "MyGUI.h" #include "MyGUI_OgrePlatform.h"
Before you initialize the GUI, be sure to create a viewport. This is sent to the OgrePlatform class and stores it for later use in the "initialise" method call.
declaration:
MyGUI::Gui* mGUI; MyGUI::OgrePlatform* mPlatform;
initialisation:
mPlatform = new MyGUI::OgrePlatform(); mPlatform->initialise(mWindow, mSceneManager); // mWindow is Ogre::RenderWindow*, mSceneManager is Ogre::SceneManager* mGUI = new MyGUI::Gui(); mGUI->initialise();
Note: Make sure you init MyGUI after you've initialized it's resource group in Ogre's ResourceManager (or called initialiseAllResourceGroups() if you don't care about resource groups). Otherwise MyGUI will not display anything, even though MyGUI.log will indicate that all .xml files were found and everything is working fine.