summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-09 13:22:30 -0700
committerIra Rice <irarice@gmail.com>2009-01-09 13:22:30 -0700
commita9716272cd2b5720a88f3d6904ec0f156177266d (patch)
tree5f8d1cfa38008548ba42bcb2989bc61befc4c340 /src/gui/minimap.cpp
parent4cddba3b2a759d2d794809a6b7cc3e46ca88d9dd (diff)
downloadmana-a9716272cd2b5720a88f3d6904ec0f156177266d.tar.gz
mana-a9716272cd2b5720a88f3d6904ec0f156177266d.tar.bz2
mana-a9716272cd2b5720a88f3d6904ec0f156177266d.tar.xz
mana-a9716272cd2b5720a88f3d6904ec0f156177266d.zip
Fixed minimap state saving.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r--src/gui/minimap.cpp17
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);