Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8031


Ignore:
Timestamp:
Mar 6, 2011, 2:02:18 PM (14 years ago)
Author:
landauf
Message:

added workaround for systems (linux?) where there's no color depth written to the ogre.cfg file. hope this works, couldn't test it here.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/libraries/core/GraphicsManager.cc

    r8018 r8031  
    512512    std::string GraphicsManager::setScreenResolution(unsigned int width, unsigned int height, bool fullscreen)
    513513    {
    514         this->ogreRoot_->getRenderSystem()->setConfigOption("Video Mode", multi_cast<std::string>(width) + " x " + multi_cast<std::string>(height) + " @ " + multi_cast<std::string>(this->getRenderWindow()->getColourDepth()) + "-bit colour");
     514        // workaround to detect if the colour depth should be written to the config file
     515        bool bWriteColourDepth = false;
     516        Ogre::ConfigOptionMap& options = ogreRoot_->getRenderSystem()->getConfigOptions();
     517        Ogre::ConfigOptionMap::iterator it = options.find("Video Mode");
     518        if (it != options.end())
     519            bWriteColourDepth = (it->second.currentValue.find('@') != std::string::npos);
     520
     521        if (bWriteColourDepth)
     522        {
     523            this->ogreRoot_->getRenderSystem()->setConfigOption("Video Mode", multi_cast<std::string>(width)
     524                                                                    + " x " + multi_cast<std::string>(height)
     525                                                                    + " @ " + multi_cast<std::string>(this->getRenderWindow()->getColourDepth()) + "-bit colour");
     526        }
     527        else
     528        {
     529            this->ogreRoot_->getRenderSystem()->setConfigOption("Video Mode", multi_cast<std::string>(width)
     530                                                                    + " x " + multi_cast<std::string>(height));
     531        }
     532
    515533        this->ogreRoot_->getRenderSystem()->setConfigOption("Full Screen", fullscreen ? "Yes" : "No");
    516534
Note: See TracChangeset for help on using the changeset viewer.