From 4924e4a50ae31c30f783285f6e10ac3651c1e6e8 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 16 Feb 2009 20:54:00 +0100 Subject: Fixed GUI opacity in SDL mode By using indexed instead of alpha-layered images, the GUI opacity can also be supported in software mode. --- data/graphics/gui/button.png | Bin 481 -> 360 bytes data/graphics/gui/button_disabled.png | Bin 358 -> 222 bytes data/graphics/gui/buttonhi.png | Bin 480 -> 360 bytes data/graphics/gui/buttonpress.png | Bin 424 -> 344 bytes data/graphics/gui/close_button.png | Bin 637 -> 471 bytes data/graphics/gui/deepbox.png | Bin 307 -> 219 bytes data/graphics/gui/default.png | Bin 1461 -> 832 bytes data/graphics/gui/hscroll_left_default.png | Bin 402 -> 339 bytes data/graphics/gui/hscroll_left_highlight.png | Bin 381 -> 300 bytes data/graphics/gui/hscroll_left_pressed.png | Bin 356 -> 323 bytes data/graphics/gui/hscroll_right_default.png | Bin 346 -> 325 bytes data/graphics/gui/hscroll_right_highlight.png | Bin 379 -> 330 bytes data/graphics/gui/hscroll_right_pressed.png | Bin 351 -> 325 bytes data/graphics/gui/item_shortcut_bgr.png | Bin 1366 -> 810 bytes data/graphics/gui/radioin.png | Bin 438 -> 460 bytes data/graphics/gui/radioout.png | Bin 346 -> 310 bytes data/graphics/gui/resize.png | Bin 518 -> 417 bytes data/graphics/gui/slider.png | Bin 615 -> 472 bytes data/graphics/gui/speech_bubble.png | Bin 2031 -> 1139 bytes data/graphics/gui/tab.png | Bin 427 -> 330 bytes data/graphics/gui/tabselected.png | Bin 407 -> 309 bytes data/graphics/gui/vscroll_blue.png | Bin 476 -> 338 bytes data/graphics/gui/vscroll_down_default.png | Bin 350 -> 330 bytes data/graphics/gui/vscroll_down_highlight.png | Bin 378 -> 339 bytes data/graphics/gui/vscroll_down_pressed.png | Bin 369 -> 333 bytes data/graphics/gui/vscroll_grey.png | Bin 452 -> 334 bytes data/graphics/gui/vscroll_red.png | Bin 471 -> 338 bytes data/graphics/gui/vscroll_up_default.png | Bin 359 -> 329 bytes data/graphics/gui/vscroll_up_highlight.png | Bin 381 -> 338 bytes data/graphics/gui/vscroll_up_pressed.png | Bin 345 -> 314 bytes src/gui/checkbox.cpp | 14 +++++--------- src/gui/progressbar.cpp | 11 +++++------ 32 files changed, 10 insertions(+), 15 deletions(-) diff --git a/data/graphics/gui/button.png b/data/graphics/gui/button.png index ff50a908..77123707 100644 Binary files a/data/graphics/gui/button.png and b/data/graphics/gui/button.png differ diff --git a/data/graphics/gui/button_disabled.png b/data/graphics/gui/button_disabled.png index cb5a1b01..00cdb650 100644 Binary files a/data/graphics/gui/button_disabled.png and b/data/graphics/gui/button_disabled.png differ diff --git a/data/graphics/gui/buttonhi.png b/data/graphics/gui/buttonhi.png index da30f283..a308c6c0 100644 Binary files a/data/graphics/gui/buttonhi.png and b/data/graphics/gui/buttonhi.png differ diff --git a/data/graphics/gui/buttonpress.png b/data/graphics/gui/buttonpress.png index 4c45a45f..439634aa 100644 Binary files a/data/graphics/gui/buttonpress.png and b/data/graphics/gui/buttonpress.png differ diff --git a/data/graphics/gui/close_button.png b/data/graphics/gui/close_button.png index a0a6d144..4c0356fb 100644 Binary files a/data/graphics/gui/close_button.png and b/data/graphics/gui/close_button.png differ diff --git a/data/graphics/gui/deepbox.png b/data/graphics/gui/deepbox.png index 0980f57e..39ee2032 100644 Binary files a/data/graphics/gui/deepbox.png and b/data/graphics/gui/deepbox.png differ diff --git a/data/graphics/gui/default.png b/data/graphics/gui/default.png index 29353df8..93877ad8 100644 Binary files a/data/graphics/gui/default.png and b/data/graphics/gui/default.png differ diff --git a/data/graphics/gui/hscroll_left_default.png b/data/graphics/gui/hscroll_left_default.png index 6d21e7c0..eac8bc59 100644 Binary files a/data/graphics/gui/hscroll_left_default.png and b/data/graphics/gui/hscroll_left_default.png differ diff --git a/data/graphics/gui/hscroll_left_highlight.png b/data/graphics/gui/hscroll_left_highlight.png index 1dd79658..fa37f442 100644 Binary files a/data/graphics/gui/hscroll_left_highlight.png and b/data/graphics/gui/hscroll_left_highlight.png differ diff --git a/data/graphics/gui/hscroll_left_pressed.png b/data/graphics/gui/hscroll_left_pressed.png index 92478ec8..c893406a 100644 Binary files a/data/graphics/gui/hscroll_left_pressed.png and b/data/graphics/gui/hscroll_left_pressed.png differ diff --git a/data/graphics/gui/hscroll_right_default.png b/data/graphics/gui/hscroll_right_default.png index 94c0efeb..04bcec2f 100644 Binary files a/data/graphics/gui/hscroll_right_default.png and b/data/graphics/gui/hscroll_right_default.png differ diff --git a/data/graphics/gui/hscroll_right_highlight.png b/data/graphics/gui/hscroll_right_highlight.png index ef56538f..598f7f29 100644 Binary files a/data/graphics/gui/hscroll_right_highlight.png and b/data/graphics/gui/hscroll_right_highlight.png differ diff --git a/data/graphics/gui/hscroll_right_pressed.png b/data/graphics/gui/hscroll_right_pressed.png index 36cff58a..da9113d1 100644 Binary files a/data/graphics/gui/hscroll_right_pressed.png and b/data/graphics/gui/hscroll_right_pressed.png differ diff --git a/data/graphics/gui/item_shortcut_bgr.png b/data/graphics/gui/item_shortcut_bgr.png index 01f1643a..cdc12dd4 100644 Binary files a/data/graphics/gui/item_shortcut_bgr.png and b/data/graphics/gui/item_shortcut_bgr.png differ diff --git a/data/graphics/gui/radioin.png b/data/graphics/gui/radioin.png index 9034f469..de43c28a 100644 Binary files a/data/graphics/gui/radioin.png and b/data/graphics/gui/radioin.png differ diff --git a/data/graphics/gui/radioout.png b/data/graphics/gui/radioout.png index 4e088943..26287484 100644 Binary files a/data/graphics/gui/radioout.png and b/data/graphics/gui/radioout.png differ diff --git a/data/graphics/gui/resize.png b/data/graphics/gui/resize.png index 9890f83f..327787a0 100644 Binary files a/data/graphics/gui/resize.png and b/data/graphics/gui/resize.png differ diff --git a/data/graphics/gui/slider.png b/data/graphics/gui/slider.png index 32adf4f7..c0a3b6f2 100644 Binary files a/data/graphics/gui/slider.png and b/data/graphics/gui/slider.png differ diff --git a/data/graphics/gui/speech_bubble.png b/data/graphics/gui/speech_bubble.png index 3e678099..3f17af8c 100644 Binary files a/data/graphics/gui/speech_bubble.png and b/data/graphics/gui/speech_bubble.png differ diff --git a/data/graphics/gui/tab.png b/data/graphics/gui/tab.png index 71de8c8b..b277a5f8 100644 Binary files a/data/graphics/gui/tab.png and b/data/graphics/gui/tab.png differ diff --git a/data/graphics/gui/tabselected.png b/data/graphics/gui/tabselected.png index 98dd41c6..d84fabc7 100644 Binary files a/data/graphics/gui/tabselected.png and b/data/graphics/gui/tabselected.png differ diff --git a/data/graphics/gui/vscroll_blue.png b/data/graphics/gui/vscroll_blue.png index 295ca1a5..95708aba 100644 Binary files a/data/graphics/gui/vscroll_blue.png and b/data/graphics/gui/vscroll_blue.png differ diff --git a/data/graphics/gui/vscroll_down_default.png b/data/graphics/gui/vscroll_down_default.png index 4bf696b0..5c4c30cd 100644 Binary files a/data/graphics/gui/vscroll_down_default.png and b/data/graphics/gui/vscroll_down_default.png differ diff --git a/data/graphics/gui/vscroll_down_highlight.png b/data/graphics/gui/vscroll_down_highlight.png index a7459745..47c9d155 100644 Binary files a/data/graphics/gui/vscroll_down_highlight.png and b/data/graphics/gui/vscroll_down_highlight.png differ diff --git a/data/graphics/gui/vscroll_down_pressed.png b/data/graphics/gui/vscroll_down_pressed.png index e6238024..dfea0eb8 100644 Binary files a/data/graphics/gui/vscroll_down_pressed.png and b/data/graphics/gui/vscroll_down_pressed.png differ diff --git a/data/graphics/gui/vscroll_grey.png b/data/graphics/gui/vscroll_grey.png index 4d950a32..8bb4180e 100644 Binary files a/data/graphics/gui/vscroll_grey.png and b/data/graphics/gui/vscroll_grey.png differ diff --git a/data/graphics/gui/vscroll_red.png b/data/graphics/gui/vscroll_red.png index 0e50513c..bcc45c89 100644 Binary files a/data/graphics/gui/vscroll_red.png and b/data/graphics/gui/vscroll_red.png differ diff --git a/data/graphics/gui/vscroll_up_default.png b/data/graphics/gui/vscroll_up_default.png index c08a2b2a..2556998f 100644 Binary files a/data/graphics/gui/vscroll_up_default.png and b/data/graphics/gui/vscroll_up_default.png differ diff --git a/data/graphics/gui/vscroll_up_highlight.png b/data/graphics/gui/vscroll_up_highlight.png index 2f5ffade..3cbcd861 100644 Binary files a/data/graphics/gui/vscroll_up_highlight.png and b/data/graphics/gui/vscroll_up_highlight.png differ diff --git a/data/graphics/gui/vscroll_up_pressed.png b/data/graphics/gui/vscroll_up_pressed.png index 102bac86..8762d118 100644 Binary files a/data/graphics/gui/vscroll_up_pressed.png and b/data/graphics/gui/vscroll_up_pressed.png differ diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index 7a3e2fde..413c28d0 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -46,13 +46,10 @@ CheckBox::CheckBox(const std::string& caption, bool selected): checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10); checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10); checkBoxDisabledChecked = checkBox->getSubImage(27, 0, 9, 10); - if (config.getValue("opengl", 0)) - { - checkBoxNormal->setAlpha(mAlpha); - checkBoxChecked->setAlpha(mAlpha); - checkBoxDisabled->setAlpha(mAlpha); - checkBoxDisabledChecked->setAlpha(mAlpha); - } + checkBoxNormal->setAlpha(mAlpha); + checkBoxChecked->setAlpha(mAlpha); + checkBoxDisabled->setAlpha(mAlpha); + checkBoxDisabledChecked->setAlpha(mAlpha); checkBox->decRef(); } @@ -88,8 +85,7 @@ void CheckBox::drawBox(gcn::Graphics* graphics) else box = checkBoxDisabled; - if (config.getValue("guialpha", 0.8) != mAlpha && - config.getValue("opengl", 0)) + if (config.getValue("guialpha", 0.8) != mAlpha) { mAlpha = config.getValue("guialpha", 0.8); checkBoxNormal->setAlpha(mAlpha); diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 7463d4cc..bec86bb1 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -104,10 +104,7 @@ void ProgressBar::draw(gcn::Graphics *graphics) { if (config.getValue("guialpha", 0.8) != mAlpha) { - if (config.getValue("opengl", 0)) - mAlpha = config.getValue("guialpha", 0.8); - else - mAlpha = 1.0f; + mAlpha = config.getValue("guialpha", 0.8); for (int i = 0; i < 9; i++) { mBorder.grid[i]->setAlpha(mAlpha); @@ -120,7 +117,8 @@ void ProgressBar::draw(gcn::Graphics *graphics) const int alpha = (int)(mAlpha * 255.0f); // The bar - if (mProgress > 0) { + if (mProgress > 0) + { graphics->setColor(gcn::Color(mRed, mGreen, mBlue, alpha)); graphics->fillRectangle(gcn::Rectangle(4, 4, @@ -129,7 +127,8 @@ void ProgressBar::draw(gcn::Graphics *graphics) } // The label - if (!mText.empty()) { + if (!mText.empty()) + { gcn::Font *f = boldFont; const int textX = getWidth() / 2; const int textY = (getHeight() - f->getHeight()) / 2; -- cgit v1.2.3-60-g2f50