From 5a759f8b0d9577a41d8c8ae81e23eba508e73bcd Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 3 May 2015 18:35:29 +0200 Subject: [PATCH] GUI cleanup fix --- apps/opencs/editor.cpp | 5 ----- apps/openmw/mwgui/mainmenu.cpp | 2 -- apps/openmw/mwgui/windowmanagerimp.cpp | 11 +++++++---- components/fontloader/fontloader.cpp | 11 ++++++++++- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 83fcb3e37..56076dbe0 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -311,11 +311,6 @@ int CS::Editor::run() return QApplication::exec(); } - // for font used in overlays - //Ogre::Root::getSingleton().addResourceLocation ((mResources / "mygui").string(), - // "FileSystem", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true); - - void CS::Editor::documentAdded (CSMDoc::Document *document) { mViewManager.addView (document); diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp index 48f9ee42c..ef86666f4 100644 --- a/apps/openmw/mwgui/mainmenu.cpp +++ b/apps/openmw/mwgui/mainmenu.cpp @@ -1,7 +1,5 @@ #include "mainmenu.hpp" -#include - #include #include #include diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index c32f2bfe8..abc19b3f9 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -30,6 +30,8 @@ #include +#include + #include #include @@ -180,8 +182,8 @@ namespace MWGui mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager()); mGuiPlatform->initialise(resourcePath, logpath); - MyGUI::Gui* gui = new MyGUI::Gui; - gui->initialise(""); + mGui = new MyGUI::Gui; + mGui->initialise(""); createTextures(); @@ -307,8 +309,8 @@ namespace MWGui std::string hitFaderTexture = "textures\\bm_player_hit_01.dds"; // fall back to player_hit_01.dds if bm_player_hit_01.dds is not available // TODO: check if non-BM versions actually use player_hit_01.dds - //if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(hitFaderTexture)) - // hitFaderTexture = "textures\\player_hit_01.dds"; + if(!mResourceSystem->getVFS()->exists(hitFaderTexture)) + hitFaderTexture = "textures\\player_hit_01.dds"; mHitFader = new ScreenFader(hitFaderTexture); mScreenFader = new ScreenFader("black.png"); @@ -421,6 +423,7 @@ namespace MWGui mFontLoader.reset(); + delete mGui; delete mGuiPlatform; } diff --git a/components/fontloader/fontloader.cpp b/components/fontloader/fontloader.cpp index 080c64c4c..7635c43da 100644 --- a/components/fontloader/fontloader.cpp +++ b/components/fontloader/fontloader.cpp @@ -438,7 +438,16 @@ namespace Gui font->deserialization(root, MyGUI::Version(3,2,0)); - MyGUI::ResourceManager::getInstance().removeByName(font->getResourceName()); + for (std::vector::iterator it = mFonts.begin(); it != mFonts.end();) + { + if ((*it)->getResourceName() == font->getResourceName()) + { + MyGUI::ResourceManager::getInstance().removeByName(font->getResourceName()); + it = mFonts.erase(it); + } + else + ++it; + } MyGUI::ResourceManager::getInstance().addResource(font); }