#include using namespace std; #include #include #include #include #include #include #include #include #include #include #include // Frame listener struct Listener : public Ogre::FrameListener { bool exit; Mangle::Input::Driver *input; Listener() : exit(false) {} bool frameStarted(const Ogre::FrameEvent &evt) { if(input) input->capture(); if(input->isDown(OIS::KC_ESCAPE)) exit = true; return !exit; } }; int main() { OEngine::Render::OgreRenderer ogre; ogre.configure(false, "plugins.cfg", false); ogre.createWindow("MyGUI test"); ogre.createScene(); Listener listener; ogre.getRoot()->addFrameListener(&listener); cout << "Adding data path and BSA\n"; // Add the Morrowind window resources Ogre::ResourceGroupManager::getSingleton(). addResourceLocation("resources/mygui/", "FileSystem", "General"); // And add the BSA, since most of the window bitmaps are located // there addBSA("data/Morrowind.bsa"); cout << "Setting up input with OIS\n"; Mangle::Input::OISDriver input(ogre.getWindow()); listener.input = &input; // Make sure you load the data paths BEFORE you initialize the // GUI. MyGUI depends on finding core.xml in resources/mygui/. cout << "Setting up MyGUI\n"; OEngine::GUI::MyGUIManager gui(ogre.getWindow(), ogre.getScene()); cout << "Connecting to input\n"; OEngine::GUI::EventInjector *evt = new OEngine::GUI::EventInjector(gui.getGui()); input.setEvent(Mangle::Input::EventPtr(evt)); cout << "Setting up the window manager\n"; MWGui::WindowManager gm(gui.getGui()); gm.setMode(MWGui::GM_Inventory); cout << "Starting rendering loop\n"; cout << "PRESS ESCAPE TO EXIT\n"; ogre.start(); ogre.screenshot("mygui_test.png"); cout << "Done.\n"; return 0; }