summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-11-30 17:33:18 -0700
committerIra Rice <irarice@gmail.com>2008-11-30 17:33:18 -0700
commit124968ec059f75b47b605ab1218e984e8cb15f48 (patch)
treece5bb97aa22abe97f84fcd47357093ca372366c6 /src/gui/minimap.cpp
parent5345796e2e8263c50a5b29d539a55f34467d61d2 (diff)
downloadmana-client-124968ec059f75b47b605ab1218e984e8cb15f48.tar.gz
mana-client-124968ec059f75b47b605ab1218e984e8cb15f48.tar.bz2
mana-client-124968ec059f75b47b605ab1218e984e8cb15f48.tar.xz
mana-client-124968ec059f75b47b605ab1218e984e8cb15f48.zip
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 <irarice@gmail.com>
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r--src/gui/minimap.cpp13
1 files changed, 10 insertions, 3 deletions
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*>(graphics)->
drawImage(mMapImage, mapOriginX, mapOriginY);
}