1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-25 06:11:35 +00:00

splash screens on startup

This commit is contained in:
scrawl 2012-09-12 19:15:29 +02:00
parent c3966a7c5a
commit a96ed6ac61
4 changed files with 48 additions and 1 deletions

View file

@ -11,6 +11,8 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWGui namespace MWGui
{ {
@ -20,6 +22,7 @@ namespace MWGui
, WindowBase("openmw_loading_screen.layout", parWindowManager) , WindowBase("openmw_loading_screen.layout", parWindowManager)
, mLoadingOn(false) , mLoadingOn(false)
, mLastRenderTime(0.f) , mLastRenderTime(0.f)
, mFirstLoad(true)
{ {
getWidget(mLoadingText, "LoadingText"); getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar"); getWidget(mProgressBar, "ProgressBar");
@ -139,7 +142,8 @@ namespace MWGui
} }
else else
{ {
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName()); if (!mFirstLoad)
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName());
mRectangle->setVisible(true); mRectangle->setVisible(true);
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i) for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
@ -171,6 +175,30 @@ namespace MWGui
{ {
setVisible(true); setVisible(true);
mLoadingOn = true; mLoadingOn = true;
if (mFirstLoad)
{
/// \todo use a directory listing here
std::vector<std::string> 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);
mWindowManager.pushGuiMode(GM_LoadingWallpaper);
}
else
mWindowManager.pushGuiMode(GM_Loading);
} }
@ -178,5 +206,10 @@ namespace MWGui
{ {
setVisible(false); setVisible(false);
mLoadingOn = false; mLoadingOn = false;
mFirstLoad = false;
mRectangle->setVisible(false);
mWindowManager.removeGuiMode(GM_Loading);
mWindowManager.removeGuiMode(GM_LoadingWallpaper);
} }
} }

View file

@ -19,6 +19,8 @@ namespace MWGui
void onResChange(int w, int h); void onResChange(int w, int h);
private: private:
bool mFirstLoad;
Ogre::SceneManager* mSceneMgr; Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow; Ogre::RenderWindow* mWindow;

View file

@ -35,6 +35,9 @@ namespace MWGui
// interactive MessageBox // interactive MessageBox
GM_InterMessageBox, GM_InterMessageBox,
GM_Loading,
GM_LoadingWallpaper,
GM_QuickKeysMenu GM_QuickKeysMenu
}; };

View file

@ -248,6 +248,8 @@ void WindowManager::updateVisible()
mSpellWindow->setVisible(false); mSpellWindow->setVisible(false);
mQuickKeysMenu->setVisible(false); mQuickKeysMenu->setVisible(false);
mHud->setVisible(true);
// Mouse is visible whenever we're not in game mode // Mouse is visible whenever we're not in game mode
MyGUI::PointerManager::getInstance().setVisible(isGuiMode()); MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
@ -340,6 +342,13 @@ void WindowManager::updateVisible()
case GM_Journal: case GM_Journal:
mJournal->setVisible(true); mJournal->setVisible(true);
break; break;
case GM_LoadingWallpaper:
mHud->setVisible(false);
MyGUI::PointerManager::getInstance().setVisible(false);
break;
case GM_Loading:
MyGUI::PointerManager::getInstance().setVisible(false);
break;
default: default:
// Unsupported mode, switch back to game // Unsupported mode, switch back to game
break; break;