1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-07 03:40:15 +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/inputmanager.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWGui
{
@ -20,6 +22,7 @@ namespace MWGui
, WindowBase("openmw_loading_screen.layout", parWindowManager)
, mLoadingOn(false)
, mLastRenderTime(0.f)
, mFirstLoad(true)
{
getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar");
@ -139,7 +142,8 @@ namespace MWGui
}
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);
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
@ -171,6 +175,30 @@ namespace MWGui
{
setVisible(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);
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);
private:
bool mFirstLoad;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;

View File

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

View File

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