diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-13 17:52:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-13 17:52:35 +0300 |
commit | 12e311bd5261078e02bffe63e125f89ae1a57209 (patch) | |
tree | 9a71f8e4ca78ea6f5eb09ccdb3bd6cd95830c884 /src/gui/gui.cpp | |
parent | 258f968327f6e790e11e809070c5ea5dc21a299c (diff) | |
download | plus-12e311bd5261078e02bffe63e125f89ae1a57209.tar.gz plus-12e311bd5261078e02bffe63e125f89ae1a57209.tar.bz2 plus-12e311bd5261078e02bffe63e125f89ae1a57209.tar.xz plus-12e311bd5261078e02bffe63e125f89ae1a57209.zip |
Move some code from logic queue to separate calls.
It can improve perfomance in slow systems.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r-- | src/gui/gui.cpp | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ea6112262..d8cc42011 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -56,7 +56,7 @@ Gui *gui = nullptr; SDLInput *guiInput = nullptr; // Bolded font -gcn::Font *boldFont = nullptr; +SDLFont *boldFont = nullptr; class GuiConfigListener : public ConfigListener { @@ -244,19 +244,6 @@ void Gui::logic() ResourceManager *resman = ResourceManager::getInstance(); resman->clearScheduled(); - // Fade out mouse cursor after extended inactivity - if (mMouseInactivityTimer < 100 * 15) - { - ++mMouseInactivityTimer; - mMouseCursorAlpha = std::min(1.0f, mMouseCursorAlpha + 0.05f); - } - else - { - mMouseCursorAlpha = std::max(0.0f, mMouseCursorAlpha - 0.005f); - } - - Palette::advanceGradients(); - if (!mTop) return; @@ -264,14 +251,37 @@ void Gui::logic() handleModalMouseInputFocus(); if (mInput) - { -// mInput->_pollInput(); handleMouseInput(); - } mTop->logic(); } +void Gui::slowLogic() +{ + Palette::advanceGradients(); + + // Fade out mouse cursor after extended inactivity + if (mMouseInactivityTimer < 100 * 15) + { + ++mMouseInactivityTimer; + mMouseCursorAlpha = std::min(1.0f, mMouseCursorAlpha + 0.05f); + } + else + { + mMouseCursorAlpha = std::max(0.0f, mMouseCursorAlpha - 0.005f); + } + if (mGuiFont) + mGuiFont->slowLogic(); + if (mInfoParticleFont) + mInfoParticleFont->slowLogic(); + if (mHelpFont) + mHelpFont->slowLogic(); + if (mSecureFont) + mSecureFont->slowLogic(); + if (boldFont) + boldFont->slowLogic(); +} + bool Gui::handleInput() { if (mInput) |