History: MyGUI FAQ
Preview of version: 4
Q: Why when creating any widget I have exception "layer 'any_layer_name' not found"?
A:
- Check that MyGUI_Media folder in resources.cfg
- Check that MyGUI_Media folder in default resource group General
- For loading MyGUI from another resource group write this
Copy to clipboard
mGUI->initialise(your_window, "core.xml", '''your_resource_group''');
Q: Why Combobox popup/Tab widget sheets selecting/RenderBox autorotate/Progress bar autotrack/Edit caret blinking/Message doesn't work?
A: All of this happens when you don't call inject every frame.
Copy to clipboard
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
Q: Why do the GUI disappears when I change the camera?
A: If a new camera have a new Scene Manager, you need set the GUI on a new Scene Manager.
Copy to clipboard
mGUI->setSceneManager(mCamera->getSceneManager());
Q: What function do I have to call so my checkBox actually stays checked after it was clicked?
Or just add this two lines to your on click event if you already have it.
A: Add eventMouseButtonClick:
Copy to clipboard
button->eventMouseButtonClick = MyGUI::newDelegate(this, &[class_name]::notifyToggleCheck); void [class_name]::notifyToggleCheck(MyGUI::WidgetPtr _sender) { MyGUI::ButtonPtr checkbox = _sender->castType<MyGUI::Button>(); checkbox->setStateCheck(!checkbox->getStateCheck()); }
Q: My code compiles and runs. The logs do not report any problems, but all I see is a blank screen.
A: Make sure you either create the scene manager, camera, and viewport before you initialize the ogre platform class, or you set the viewport.
Q: My code compiles and runs as in the previous question. My scene displays, but I don't see the GUI
A: If you are using multiple viewports, you need to tell the platform render manager about this:
Copy to clipboard
(MyGUI::OgrePlatform*)pPlatform->getRenderManagerPtr()->setActiveViewport(1);
The parameter is the index of the viewport in the Ogre render window, and is equal to the return value of Ogre::RenderWindow::getNumViewports() just before the viewport used for MyGUI is generated. If you generate viewports dynamically, make sure you repeat this with a decremented index after you remove a viewport that was created before the MyGUI viewport.