summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
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));
}
}