diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-21 23:25:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-21 23:25:05 +0300 |
commit | 3f2984d27b3ca03bac760b68db64db84cd75da49 (patch) | |
tree | 645e0e11a3af58b19dd4b78dc876d85a20b26933 | |
parent | 4fb515c4d3ec3b2109c7e406ae3169c534854513 (diff) | |
download | manaplus-3f2984d27b3ca03bac760b68db64db84cd75da49.tar.gz manaplus-3f2984d27b3ca03bac760b68db64db84cd75da49.tar.bz2 manaplus-3f2984d27b3ca03bac760b68db64db84cd75da49.tar.xz manaplus-3f2984d27b3ca03bac760b68db64db84cd75da49.zip |
Add option to enable/disable software mode compoundsprite update delay.
-rw-r--r-- | src/compoundsprite.cpp | 11 | ||||
-rw-r--r-- | src/compoundsprite.h | 4 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/game.cpp | 3 | ||||
-rw-r--r-- | src/gui/setup_perfomance.cpp | 3 |
5 files changed, 18 insertions, 4 deletions
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index 09ac4b390..c6243c00c 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -48,6 +48,7 @@ static const unsigned cache_max_size = 10; static const unsigned cache_clean_part = 3; +bool CompoundSprite::mEnableDelay = true; CompoundSprite::CompoundSprite() : mCacheItem(nullptr), @@ -442,10 +443,12 @@ void CompoundSprite::updateImages() const return; #endif - if (get_elapsed_time1(mNextRedrawTime) < 10) - return; - - mNextRedrawTime = tick_time; + if (mEnableDelay) + { + if (get_elapsed_time1(mNextRedrawTime) < 10) + return; + mNextRedrawTime = tick_time; + } mNeedsRedraw = false; if (!mDisableBeingCaching) diff --git a/src/compoundsprite.h b/src/compoundsprite.h index aa90816c5..0490be8d8 100644 --- a/src/compoundsprite.h +++ b/src/compoundsprite.h @@ -121,6 +121,9 @@ public: bool updateNumber(unsigned num); + static void setEnableDelay(bool b) + { mEnableDelay = b; } + private: void redraw() const; @@ -146,6 +149,7 @@ private: bool mDisableBeingCaching; std::vector<Sprite*> mSprites; mutable int mNextRedrawTime; + static bool mEnableDelay; }; #endif // COMPOUNDSPRITE_H diff --git a/src/defaults.cpp b/src/defaults.cpp index 30cbc8a57..3aeca07a6 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -260,6 +260,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "videodetected", false); AddDEF(configData, "hideErased", false); AddDEF(configData, "enableDelayedAnimations", true); + AddDEF(configData, "enableCompoundSpriteDelay", true); return configData; } diff --git a/src/game.cpp b/src/game.cpp index 253f9fb67..4ae5607a0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -390,6 +390,9 @@ Game::Game(): AnimatedSprite::setEnableCache(mainGraphics->getOpenGL() && config.getBoolValue("enableDelayedAnimations")); + CompoundSprite::setEnableDelay( + config.getBoolValue("enableCompoundSpriteDelay")); + createGuiWindows(); windowMenu = new WindowMenu; diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp index e6cd75436..1a0c892a9 100644 --- a/src/gui/setup_perfomance.cpp +++ b/src/gui/setup_perfomance.cpp @@ -66,6 +66,9 @@ Setup_Perfomance::Setup_Perfomance() new SetupItemCheckBox(_("Enable map reduce (Software)"), "", "enableMapReduce", this, "enableMapReduceEvent"); + new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "", + "enableCompoundSpriteDelay", this, "enableCompoundSpriteDelayEvent"); + new SetupItemCheckBox(_("Enable delayed images load (OpenGL)"), "", "enableDelayedAnimations", this, "enableDelayedAnimationsEvent"); |