From ecf588b5ef86804b0074c54b6371cda9e8f346c2 Mon Sep 17 00:00:00 2001 From: Bertram Date: Thu, 3 Sep 2009 20:37:08 +0200 Subject: Resolved Mantis #847: Login stage Windows won't go less than the default gui opacity. Of course, in-game, the wanted opacity still shows up. --- src/gui/widgets/tab.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'src/gui/widgets/tab.cpp') diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 3e49263e..99a95d96 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -30,6 +30,7 @@ #include "resources/image.h" #include "resources/resourcemanager.h" +#include "gui/skin.h" #include "utils/dtor.h" @@ -116,6 +117,26 @@ void Tab::init() mInstances++; } +void Tab::updateAlpha() +{ + float alpha = std::max(config.getValue("guialpha", 0.8), + (double)SkinLoader::instance()->getMinimumOpacity()); + + // TODO We don't need to do this for every tab on every draw + // Maybe use a config listener to do it as the value changes. + if (alpha != mAlpha) + { + mAlpha = alpha; + for (int a = 0; a < 9; a++) + { + for (int t = 0; t < TAB_COUNT; t++) + { + tabImg[t].grid[a]->setAlpha(mAlpha); + } + } + } +} + void Tab::draw(gcn::Graphics *graphics) { int mode = TAB_STANDARD; @@ -139,19 +160,7 @@ void Tab::draw(gcn::Graphics *graphics) } } - // TODO We don't need to do this for every tab on every draw - // Maybe use a config listener to do it as the value changes. - if (config.getValue("guialpha", 0.8) != mAlpha) - { - mAlpha = config.getValue("guialpha", 0.8); - for (int a = 0; a < 9; a++) - { - for (int t = 0; t < TAB_COUNT; t++) - { - tabImg[t].grid[a]->setAlpha(mAlpha); - } - } - } + updateAlpha(); // draw tab static_cast(graphics)-> -- cgit v1.2.3-70-g09d2