Am I deleted CEGUI correctly?
Posted: Sat Jun 20, 2009 17:39
Alright, I'm trying to make a GUI manager for the GameManager system for Ogre3D.
I need you guys to tell me if I'm deleting this stuff in the correct order...
The only happens once, when the GUI is deleted when the game exits.
This is how everything is initialized:
I need you guys to tell me if I'm deleting this stuff in the correct order...
The only happens once, when the GUI is deleted when the game exits.
Code: Select all
GUIManager::~GUIManager()
{
mp_guiRenderer->clearRenderList();
mp_guiRenderer->destroyAllTextures();
mp_guiRenderer->removeAllEvents();
delete mp_guiRenderer;
mp_guiSystem->cleanupXMLParser();
mp_guiSystem->removeAllEvents();
delete mp_guiSystem;
}
This is how everything is initialized:
Code: Select all
GUIManager::GUIManager()
{
Ogre::RenderWindow *pOgreRendWin = GameManager::getSingleton()->getOgreRenderWindowPtr();
mp_guiRenderer = new CEGUI::OgreCEGUIRenderer(
pOgreRendWin, Ogre::RENDER_QUEUE_OVERLAY, false, 3000);
mp_guiSystem = new CEGUI::System (mp_guiRenderer);
CEGUI::SchemeManager::getSingleton().loadScheme(
(CEGUI::utf8*)"TaharezLook.scheme");
CEGUI::SchemeManager::getSingleton().loadScheme(
(CEGUI::utf8*)"VanillaSkin.scheme");
CEGUI::SchemeManager::getSingleton().loadScheme(
(CEGUI::utf8*)"WindowsLook.scheme");
mp_guiSystem->setDefaultMouseCursor ((CEGUI::utf8*)"TaharezLook",
(CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage(
CEGUI::System::getSingleton().getDefaultMouseCursor());
if (! CEGUI::FontManager::getSingleton().isFontPresent("BlueHighway-12"))
CEGUI::FontManager::getSingleton().createFont("bluehighway-12.font");
if (! CEGUI::FontManager::getSingleton().isFontPresent("BlueHighway-10"))
CEGUI::FontManager::getSingleton().createFont("bluehighway-10.font");
if (! CEGUI::FontManager::getSingleton().isFontPresent("BlueHighway-8"))
CEGUI::FontManager::getSingleton().createFont("bluehighway-8.font");
if (! CEGUI::FontManager::getSingleton().isFontPresent("Commonwealth-10"))
CEGUI::FontManager::getSingleton().createFont("Commonwealth-10.font");
delete pOgreRendWin;
}