summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/minimap.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index f07cb417..c9bfe673 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -70,6 +70,18 @@ void Minimap::draw(gcn::Graphics *graphics)
{
mapOriginX += (a.width - player_node->mX) / 2;
mapOriginY += (a.height - player_node->mY) / 2;
+
+ const int minOriginX = a.x + a.width - mMapImage->getWidth();
+ const int minOriginY = a.y + a.height - mMapImage->getHeight();
+
+ if (mapOriginX < minOriginX)
+ mapOriginX = minOriginX;
+ if (mapOriginY < minOriginY)
+ mapOriginY = minOriginY;
+ if (mapOriginX > a.x)
+ mapOriginX = a.x;
+ if (mapOriginY > a.y)
+ mapOriginY = a.y;
}
static_cast<Graphics*>(graphics)->
drawImage(mMapImage, mapOriginX, mapOriginY);