diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-09 13:22:30 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-09 13:22:30 -0700 |
commit | a9716272cd2b5720a88f3d6904ec0f156177266d (patch) | |
tree | 5f8d1cfa38008548ba42bcb2989bc61befc4c340 /src/gui | |
parent | 4cddba3b2a759d2d794809a6b7cc3e46ca88d9dd (diff) | |
download | mana-client-a9716272cd2b5720a88f3d6904ec0f156177266d.tar.gz mana-client-a9716272cd2b5720a88f3d6904ec0f156177266d.tar.bz2 mana-client-a9716272cd2b5720a88f3d6904ec0f156177266d.tar.xz mana-client-a9716272cd2b5720a88f3d6904ec0f156177266d.zip |
Fixed minimap state saving.
Signed-off-by: Ira Rice <irarice@gmail.com>
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; |