summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-10-13 17:34:42 +0000
committerIra Rice <irarice@gmail.com>2008-10-13 17:34:42 +0000
commit8003fcc9f42a42170a16bdf976bb73fdf34a761e (patch)
treeabb550979c6eeacf1db7659df4aceb7d963d0590 /src/gui/minimap.cpp
parenta4d2f2c0373848fa8a886c1dddc6247b81527df3 (diff)
downloadMana-8003fcc9f42a42170a16bdf976bb73fdf34a761e.tar.gz
Mana-8003fcc9f42a42170a16bdf976bb73fdf34a761e.tar.bz2
Mana-8003fcc9f42a42170a16bdf976bb73fdf34a761e.tar.xz
Mana-8003fcc9f42a42170a16bdf976bb73fdf34a761e.zip
Changed minimap code so that it allows us to have larger minimaps, while
putting back in backwards compatibility with TMW style minimaps. While this might seem like a big deal, it also allows us to make minimaps as big as we'd like, which is a huge perk for really large maps or really small ones.
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r--src/gui/minimap.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 9f4df73c..1f3a903c 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -32,7 +32,8 @@
Minimap::Minimap():
Window("Map"),
- mMapImage(NULL)
+ mMapImage(NULL),
+ mProportion(0.5)
{
setWindowName("MiniMap");
}
@@ -57,9 +58,13 @@ void Minimap::setMapImage(Image *img)
if (mMapImage)
{
mMapImage->setAlpha(0.7);
- setDefaultSize(5, 25, img->getWidth(), img->getHeight());
+ setDefaultSize(5, 25, mMapImage->getWidth(), mMapImage->getHeight());
loadWindowState();
}
+ else
+ {
+ setVisible(false);
+ }
}
void Minimap::draw(gcn::Graphics *graphics)
@@ -103,11 +108,11 @@ void Minimap::draw(gcn::Graphics *graphics)
continue;
}
- int offset = (dotSize - 1);
+ int offset = (dotSize - 1) * mProportion;
graphics->fillRectangle(gcn::Rectangle(
- being->mX + getPadding() - offset,
- being->mY + getTitleBarHeight() - offset,
+ (being->mX * mProportion) + getPadding() - offset,
+ (being->mY * mProportion) + getTitleBarHeight() - offset,
dotSize, dotSize));
}
}