1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 03:53:54 +00:00

Fix loading screen looking for wallpapers in a fixed group.

This commit is contained in:
scrawl 2013-04-03 12:24:13 +02:00
parent 05a5cb3ae4
commit aac2ba1d5f
2 changed files with 14 additions and 8 deletions

View file

@ -217,15 +217,21 @@ namespace MWGui
void LoadingScreen::changeWallpaper () void LoadingScreen::changeWallpaper ()
{ {
if (mResources.isNull ()) if (mResources.empty())
mResources = Ogre::ResourceGroupManager::getSingleton ().findResourceNames ("General", "Splash_*.tga");
if (mResources->size())
{ {
std::string const & randomSplash = mResources->at (rand() % mResources->size()); Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = Ogre::ResourceGroupManager::getSingleton ().findResourceNames (*it, "Splash_*.tga");
mResources.insert(mResources.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
}
}
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, "General"); if (!mResources.empty())
{
std::string const & randomSplash = mResources.at (rand() % mResources.size());
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
mBackgroundImage->setImageTexture (randomSplash); mBackgroundImage->setImageTexture (randomSplash);
} }

View file

@ -44,7 +44,7 @@ namespace MWGui
Ogre::Rectangle2D* mRectangle; Ogre::Rectangle2D* mRectangle;
Ogre::MaterialPtr mBackgroundMaterial; Ogre::MaterialPtr mBackgroundMaterial;
Ogre::StringVectorPtr mResources; Ogre::StringVector mResources;
bool mLoadingOn; bool mLoadingOn;