diff options
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r-- | src/gui/minimap.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 8519b985..ebeed6d7 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -23,6 +23,7 @@ #include "../being.h" #include "../beingmanager.h" +#include "../configuration.h" #include "../graphics.h" #include "../localplayer.h" @@ -30,6 +31,8 @@ #include "../utils/gettext.h" +bool Minimap::mShow = config.getValue("MinimapVisible", true); + Minimap::Minimap(): Window(_("Map")), mMapImage(NULL), @@ -56,13 +59,14 @@ void Minimap::setMapImage(Image *img) { int offsetX = getPadding() + 4; int offsetY = getTitleBarHeight() + 4; - mMapImage->setAlpha(0.7); + mMapImage->setAlpha(config.getValue("guialpha", 0.8)); setDefaultSize(offsetX, offsetY, mMapImage->getWidth() < 100 ? mMapImage->getWidth() + offsetX : 100, mMapImage->getHeight() < 100 ? mMapImage->getHeight() + offsetY : 100); loadWindowState(); + setVisible(mShow); } else { @@ -70,10 +74,21 @@ void Minimap::setMapImage(Image *img) } } +void Minimap::toggle() +{ + mShow = !mShow; + config.setValue("MinimapVisible", mShow); +} + void Minimap::draw(gcn::Graphics *graphics) { + setVisible(mShow); + Window::draw(graphics); + if (!mShow) + return; + const gcn::Rectangle a = getChildrenArea(); graphics->pushClipArea(a); |