diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-04-30 21:47:46 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-04-30 21:47:46 +0000 |
commit | 4f612935a68d450ad47f6366ef07b4032823653f (patch) | |
tree | 23c75e2a50d57bae161a62c05736aa289c8b0da8 /src/gui | |
parent | a1fa39b43639137e141febf67224f698ec17aec9 (diff) | |
download | mana-client-4f612935a68d450ad47f6366ef07b4032823653f.tar.gz mana-client-4f612935a68d450ad47f6366ef07b4032823653f.tar.bz2 mana-client-4f612935a68d450ad47f6366ef07b4032823653f.tar.xz mana-client-4f612935a68d450ad47f6366ef07b4032823653f.zip |
Correctly draw window borders with GUI opacity in OpenGL mode.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/window.cpp | 24 | ||||
-rw-r--r-- | src/gui/window.h | 6 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 62daa9cd..eacb3d6d 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -46,8 +46,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): // Load dialog title bar image ResourceManager *resman = ResourceManager::getInstance(); - dBorders = resman->getImage("graphics/gui/vscroll_grey.png"); - dBackground = resman->getImage("graphics/gui/bg_quad_dis.png"); + Image *dBorders = resman->getImage("graphics/gui/vscroll_grey.png"); border.grid[0] = dBorders->getSubImage(0, 0, 4, 4); border.grid[1] = dBorders->getSubImage(4, 0, 3, 4); @@ -59,6 +58,9 @@ Window::Window(const std::string& caption, bool modal, Window *parent): border.grid[7] = dBorders->getSubImage(4, 15, 3, 4); border.grid[8] = dBorders->getSubImage(7, 15, 4, 4); + dBorders->decRef(); + dBorders = NULL; + // Add chrome chrome = new gcn::Container(); chrome->setOpaque(false); @@ -72,12 +74,8 @@ Window::Window(const std::string& caption, bool modal, Window *parent): throw GCN_EXCEPTION("Window::Window. no windowContainer set"); } - // Load GUI alpha setting - guiAlpha = config.getValue("guialpha", 0.8f); - - // Set GUI alpha level - dBackground->setAlpha(guiAlpha); - dBorders->setAlpha(guiAlpha); + // Send GUI alpha changed for initialization + optionChanged("guialpha"); config.addListener("guialpha", this); } @@ -254,12 +252,14 @@ void Window::optionChanged(const std::string &name) { if (name == "guialpha") { - guiAlpha = config.getValue("guialpha", 0.8); + float guiAlpha = config.getValue("guialpha", 0.8); - if (dBackground->getAlpha() != guiAlpha) + for (int i = 0; i < 9; i++) { - dBackground->setAlpha(guiAlpha); - dBorders->setAlpha(guiAlpha); + if (border.grid[i]->getAlpha() != guiAlpha) + { + border.grid[i]->setAlpha(guiAlpha); + } } } } diff --git a/src/gui/window.h b/src/gui/window.h index 4a0f08c3..5632a292 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -43,12 +43,8 @@ class Window : public gcn::Window, public ConfigListener Window *parent; /**< The parent window */ int snapSize; /**< Snap distance to window edge */ bool modal; /**< Window is modal */ - float guiAlpha; /**< Opacity of GUI windows */ - Image *dBackground; /**< Left side of title bar */ - Image *dBorders; /**< Middle of title bar */ - - ImageRect border; /**< The window border */ + ImageRect border; /**< The window border and background */ bool resizeable; /**< Window can be resized */ int minWinWidth; /**< Minimum window width */ |