From 8003fcc9f42a42170a16bdf976bb73fdf34a761e Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Mon, 13 Oct 2008 17:34:42 +0000 Subject: 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. --- src/gui/minimap.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/gui/minimap.cpp') 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)); } } -- cgit v1.2.3-70-g09d2