From 12e311bd5261078e02bffe63e125f89ae1a57209 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 May 2012 17:52:35 +0300 Subject: Move some code from logic queue to separate calls. It can improve perfomance in slow systems. --- src/gui/gui.cpp | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'src/gui/gui.cpp') 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) -- cgit v1.2.3-60-g2f50