Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7993 for code/branches


Ignore:
Timestamp:
Feb 27, 2011, 6:26:37 PM (14 years ago)
Author:
landauf
Message:

moved fpsLimit_ config value to GraphicsSettings (seems more intuitive)
disabled fps limit if VSync is active (limits the fps anyway, but to the monitors refresh rate)

Location:
code/branches/usability/src/libraries/core
Files:
3 edited

Legend:

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

    r7284 r7993  
    5050#include "GameMode.h"
    5151#include "GameState.h"
     52#include "GraphicsManager.h"
    5253#include "GUIManager.h"
    5354#include "command/ConsoleCommand.h"
     
    142143        SetConfigValue(statisticsAvgLength_, 1000000)
    143144            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
    144         SetConfigValue(fpsLimit_, 50)
     145
     146        SetConfigValueExternal(fpsLimit_, "GraphicsSettings", "fpsLimit", 50)
    145147            .description("Sets the desired frame rate (0 for no limit).");
    146148    }
     
    207209
    208210            // Limit frame rate
    209             this->updateFPSLimiter();
     211            static bool hasVSync = GraphicsManager::getInstance().hasVSyncEnabled(); // can be static since changes of VSync currently require a restart
     212            if (this->fpsLimit_ > 0 && !hasVSync)
     213                this->updateFPSLimiter();
    210214        }
    211215
  • code/branches/usability/src/libraries/core/GraphicsManager.cc

    r7992 r7993  
    318318        CCOUT(4) << "Configuring Renderer" << std::endl;
    319319
    320         if (!ogreRoot_->restoreConfig() || Core::getInstance().getOgreConfigTimestamp() > Core::getInstance().getLastLevelTimestamp())
     320        bool updatedConfig = Core::getInstance().getOgreConfigTimestamp() > Core::getInstance().getLastLevelTimestamp();
     321        if (updatedConfig)
     322            COUT(2) << "Ogre config file has changed, but no level was started since then. Displaying config dialogue again to verify the changes." << std::endl;
     323
     324        if (!ogreRoot_->restoreConfig() || updatedConfig)
    321325        {
    322326            if (!ogreRoot_->showConfigDialog())
     
    466470    }
    467471
     472    bool GraphicsManager::hasVSyncEnabled() const
     473    {
     474        Ogre::ConfigOptionMap& options = ogreRoot_->getRenderSystem()->getConfigOptions();
     475        if (options.find("VSync") != options.end())
     476            return (options["VSync"].currentValue == "Yes");
     477        else
     478            return false;
     479    }
     480
    468481    std::string GraphicsManager::setScreenResolution(unsigned int width, unsigned int height, bool fullscreen)
    469482    {
  • code/branches/usability/src/libraries/core/GraphicsManager.h

    r7989 r7993  
    7575        size_t getRenderWindowHandle();
    7676        bool isFullScreen() const;
     77        bool hasVSyncEnabled() const;
    7778
    7879        void upgradeToGraphics();
Note: See TracChangeset for help on using the changeset viewer.