1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:23:52 +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 ()
{
if (mResources.isNull ())
mResources = Ogre::ResourceGroupManager::getSingleton ().findResourceNames ("General", "Splash_*.tga");
if (mResources->size())
if (mResources.empty())
{
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);
}

View file

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