diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/minimap.cpp | 17 | ||||
-rw-r--r-- | src/gui/minimap.h | 6 |
2 files changed, 22 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); diff --git a/src/gui/minimap.h b/src/gui/minimap.h index 7897ebdb..b6dbc322 100644 --- a/src/gui/minimap.h +++ b/src/gui/minimap.h @@ -57,6 +57,11 @@ class Minimap : public Window void setProportion(float proportion) { mProportion = proportion; } /** + * Toggles the displaying of the minimap. + */ + void toggle(); + + /** * Draws the minimap. */ void draw(gcn::Graphics *graphics); @@ -64,6 +69,7 @@ class Minimap : public Window private: Image *mMapImage; float mProportion; + static bool mShow; }; extern Minimap *minimap; |