|
|
|
@ -6,6 +6,19 @@
|
|
|
|
|
|
|
|
|
|
using namespace OEngine::GUI;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* As of MyGUI 3.2.0, MyGUI::OgreDataManager::isDataExist is unnecessarily complex
|
|
|
|
|
* this override fixes the resulting performance issue.
|
|
|
|
|
*/
|
|
|
|
|
class FixedOgreDataManager : public MyGUI::OgreDataManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
bool isDataExist(const std::string& _name)
|
|
|
|
|
{
|
|
|
|
|
return Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup (_name);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging, const std::string& logDir)
|
|
|
|
|
{
|
|
|
|
|
assert(wnd);
|
|
|
|
@ -25,11 +38,18 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
|
|
|
|
if(!logDir.empty())
|
|
|
|
|
theLogFile.insert(0, logDir);
|
|
|
|
|
|
|
|
|
|
// Set up OGRE platform. We might make this more generic later.
|
|
|
|
|
mPlatform = new OgrePlatform();
|
|
|
|
|
// Set up OGRE platform (bypassing OgrePlatform). We might make this more generic later.
|
|
|
|
|
mLogManager = new LogManager();
|
|
|
|
|
mRenderManager = new OgreRenderManager();
|
|
|
|
|
mDataManager = new FixedOgreDataManager();
|
|
|
|
|
|
|
|
|
|
LogManager::getInstance().setSTDOutputEnabled(logging);
|
|
|
|
|
mPlatform->initialise(wnd, mgr, "General", theLogFile);
|
|
|
|
|
|
|
|
|
|
if (!theLogFile.empty())
|
|
|
|
|
LogManager::getInstance().createDefaultSource(theLogFile);
|
|
|
|
|
|
|
|
|
|
mRenderManager->initialise(wnd, mgr);
|
|
|
|
|
mDataManager->initialise("General");
|
|
|
|
|
|
|
|
|
|
// Create GUI
|
|
|
|
|
mGui = new Gui();
|
|
|
|
@ -40,11 +60,22 @@ void MyGUIManager::shutdown()
|
|
|
|
|
{
|
|
|
|
|
mGui->shutdown ();
|
|
|
|
|
delete mGui;
|
|
|
|
|
if(mPlatform)
|
|
|
|
|
if(mRenderManager)
|
|
|
|
|
{
|
|
|
|
|
mRenderManager->shutdown();
|
|
|
|
|
delete mRenderManager;
|
|
|
|
|
mRenderManager = NULL;
|
|
|
|
|
}
|
|
|
|
|
if(mDataManager)
|
|
|
|
|
{
|
|
|
|
|
mDataManager->shutdown();
|
|
|
|
|
delete mDataManager;
|
|
|
|
|
mDataManager = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (mLogManager)
|
|
|
|
|
{
|
|
|
|
|
mPlatform->shutdown();
|
|
|
|
|
delete mPlatform;
|
|
|
|
|
delete mLogManager;
|
|
|
|
|
mLogManager = NULL;
|
|
|
|
|
}
|
|
|
|
|
mGui = NULL;
|
|
|
|
|
mPlatform = NULL;
|
|
|
|
|
}
|
|
|
|
|