From 7ad80e306b3292d14c0055895e7bef8093908f01 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 13 Sep 2012 12:33:09 +0200 Subject: [PATCH] fixed the disappearing --- apps/openmw/engine.cpp | 4 ++ apps/openmw/mwgui/loadingscreen.cpp | 57 +++++++++++++++++------------ apps/openmw/mwgui/loadingscreen.hpp | 3 ++ 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 82bd3b69b..db6edf397 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -162,6 +162,10 @@ void OMW::Engine::loadBSA() dataDirectory = iter->string(); std::cout << "Data dir " << dataDirectory << std::endl; Bsa::addDir(dataDirectory, mFSStrict); + + // Workaround: Mygui does not find textures in non-BSA subfolders, _unless_ they are explicitely added like this + // For splash screens, this is OK to do, but eventually we will need an investigation why this is necessary + Bsa::addDir(dataDirectory + "/Splash", mFSStrict); } } diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index a56075d4d..e41f2eec9 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -22,6 +22,7 @@ namespace MWGui , WindowBase("openmw_loading_screen.layout", parWindowManager) , mLoadingOn(false) , mLastRenderTime(0.f) + , mLastWallpaperChangeTime(0.f) , mFirstLoad(true) { getWidget(mLoadingText, "LoadingText"); @@ -107,6 +108,11 @@ namespace MWGui { mLastRenderTime = mTimer.getMilliseconds (); + if (mFirstLoad && mTimer.getMilliseconds () > mLastWallpaperChangeTime + 3000*1) + { + mLastWallpaperChangeTime = mTimer.getMilliseconds (); + changeWallpaper(); + } // Turn off rendering except the GUI mSceneMgr->clearSpecialCaseRenderQueues(); @@ -129,13 +135,14 @@ namespace MWGui if (!hasCompositor) { - //mWindow->getViewport(0)->setClearEveryFrame(false); + mWindow->getViewport(0)->setClearEveryFrame(false); } else { if (!mFirstLoad) { - //mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName()); + mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName()); + mRectangle->setVisible(true); } for (unsigned int i = 0; igetNumCompositors(); ++i) @@ -144,9 +151,6 @@ namespace MWGui } } - mRectangle->setVisible(hasCompositor || mFirstLoad); - std::cout << "rect vis? " << mRectangle->getVisible () << " first load? " << mFirstLoad << std::endl; - mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("Splash/Splash_Bonelord.tga"); mWindow->update(); if (!hasCompositor) @@ -174,44 +178,49 @@ namespace MWGui void LoadingScreen::loadingOn() { - std::cout << "loading on " < splash; - splash.push_back ("Splash/Splash_Bonelord.tga"); - splash.push_back ("Splash/Splash_ClannDaddy.tga"); - splash.push_back ("Splash/Splash_ClannFear.tga"); - splash.push_back ("Splash/Splash_Daedroth.tga"); - splash.push_back ("Splash/Splash_Hunger.tga"); - splash.push_back ("Splash/Splash_KwamaWarrior.tga"); - splash.push_back ("Splash/Splash_Netch.tga"); - splash.push_back ("Splash/Splash_NixHound.tga"); - splash.push_back ("Splash/Splash_Siltstriker.tga"); - splash.push_back ("Splash/Splash_Skeleton.tga"); - splash.push_back ("Splash/Splash_SphereCenturion.tga"); - - mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(splash[rand() % splash.size()]); - mRectangle->setVisible(true); + changeWallpaper(); mWindowManager.pushGuiMode(GM_LoadingWallpaper); } else + { + mBackgroundImage->setImageTexture(""); mWindowManager.pushGuiMode(GM_Loading); + } } void LoadingScreen::loadingOff() { - std::cout << "loading off " << std::endl; setVisible(false); mLoadingOn = false; - //mFirstLoad = false; + mFirstLoad = false; mWindowManager.removeGuiMode(GM_Loading); mWindowManager.removeGuiMode(GM_LoadingWallpaper); } + + void LoadingScreen::changeWallpaper () + { + /// \todo use a directory listing here + std::vector splash; + splash.push_back ("Splash_Bonelord.tga"); + splash.push_back ("Splash_ClannDaddy.tga"); + splash.push_back ("Splash_Clannfear.tga"); + splash.push_back ("Splash_Daedroth.tga"); + splash.push_back ("Splash_Hunger.tga"); + splash.push_back ("Splash_KwamaWarrior.tga"); + splash.push_back ("Splash_Netch.tga"); + splash.push_back ("Splash_NixHound.tga"); + splash.push_back ("Splash_Siltstriker.tga"); + splash.push_back ("Splash_Skeleton.tga"); + splash.push_back ("Splash_SphereCenturion.tga"); + + mBackgroundImage->setImageTexture (splash[rand() % splash.size()]); + } } diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp index 28d970040..a012793ca 100644 --- a/apps/openmw/mwgui/loadingscreen.hpp +++ b/apps/openmw/mwgui/loadingscreen.hpp @@ -25,6 +25,7 @@ namespace MWGui Ogre::SceneManager* mSceneMgr; Ogre::RenderWindow* mWindow; + unsigned long mLastWallpaperChangeTime; unsigned long mLastRenderTime; Ogre::Timer mTimer; @@ -46,6 +47,8 @@ namespace MWGui void loadingOn(); void loadingOff(); + + void changeWallpaper(); }; }