Page 1 of 1

Am I deleted CEGUI correctly?

Posted: Sat Jun 20, 2009 17:39
by dredogol
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.

Code: Select all

   delete mp_guiRenderer;
   delete mp_guiSystem;

This is how everything is initialized:

Code: Select all

   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);


   mp_guiSystem->setDefaultMouseCursor ((CEGUI::utf8*)"TaharezLook",

   if (! CEGUI::FontManager::getSingleton().isFontPresent("BlueHighway-12"))
   if (! CEGUI::FontManager::getSingleton().isFontPresent("BlueHighway-10"))
   if (! CEGUI::FontManager::getSingleton().isFontPresent("BlueHighway-8"))
   if (! CEGUI::FontManager::getSingleton().isFontPresent("Commonwealth-10"))

   delete pOgreRendWin;

Re: Am I deleted CEGUI correctly?

Posted: Sun Jun 21, 2009 09:05
by CrazyEddie
This is totally over the top - you're making things too complicated for yourself :)

Basically, CEGUI manages objects for you - this is why we have all those 'create' type functions instead of having you use the C++ new keyword directly, as such - under normal circumstances - the only things you need to cleanup yourself are the CEGUI::System object and the CEGUI::Renderer object (in that order), if you're using custom XMLParsers or script modules then those have to also be cleaned up, but in your case:

Code: Select all

delete mp_guiSystem;
delete mp_guiRenderer;

is all that's needed.



Re: Am I deleted CEGUI correctly?

Posted: Sun Jun 21, 2009 20:53
by dredogol
Ah, thx. =D