From 124968ec059f75b47b605ab1218e984e8cb15f48 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sun, 30 Nov 2008 17:33:18 -0700 Subject: Fixed up Minimap scrolling so that it actually scrolls (I forgot that we resized the minimap width by the map's actual width) as well as fixed the centering code so that it works. TODO: Determine a decent way to have the map scroll, but not draw the map below the map area's name. Signed-off-by: Ira Rice --- src/gui/minimap.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index bd79ec87..8b4dd9c3 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -56,8 +56,14 @@ void Minimap::setMapImage(Image *img) if (mMapImage) { + int offsetX = getPadding(); + int offsetY = getTitleBarHeight(); mMapImage->setAlpha(0.7); - setDefaultSize(5, 25, mMapImage->getWidth(), mMapImage->getHeight()); + setDefaultSize(offsetX, offsetY, + mMapImage->getWidth() < (100 + offsetX) ? + mMapImage->getWidth() : (100 + offsetX), + mMapImage->getHeight() < (100 + offsetY) ? + mMapImage->getHeight() : (100 + offsetY)); loadWindowState(); } else @@ -80,9 +86,10 @@ void Minimap::draw(gcn::Graphics *graphics) if (mMapImage->getWidth() > a.width || mMapImage->getHeight() > a.height) { - mapOriginX += (a.width - player_node->mX) / 2; - mapOriginY += (a.height - player_node->mY) / 2; + mapOriginX += ((a.width) / 2) - player_node->mX; + mapOriginY += ((a.height) / 2) - player_node->mY; } + static_cast(graphics)-> drawImage(mMapImage, mapOriginX, mapOriginY); } -- cgit v1.2.3-70-g09d2