summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-08 14:13:32 +0100
committerIra Rice <irarice@gmail.com>2008-12-08 09:46:07 -0700
commit332f02da85370a6a2cd5ddc53e252fe2ae3eb53b (patch)
treeb2aa55e3b4bc299d697a589a56b01bddb62c77d4 /src
parent224fc155978ebbce35ee42560edab628121d7d2e (diff)
downloadmana-client-332f02da85370a6a2cd5ddc53e252fe2ae3eb53b.tar.gz
mana-client-332f02da85370a6a2cd5ddc53e252fe2ae3eb53b.tar.bz2
mana-client-332f02da85370a6a2cd5ddc53e252fe2ae3eb53b.tar.xz
mana-client-332f02da85370a6a2cd5ddc53e252fe2ae3eb53b.zip
Clip the minimap image to within its window
The image wasn't clipped so it would draw beneath the map name and on top of the window border.
Diffstat (limited to 'src')
-rw-r--r--src/gui/minimap.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index bb51d64a..578e2ce6 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -74,28 +74,30 @@ void Minimap::draw(gcn::Graphics *graphics)
const gcn::Rectangle a = getChildrenArea();
- int mapOriginX = a.x;
- int mapOriginY = a.y;
+ graphics->pushClipArea(a);
+
+ int mapOriginX = 0;
+ int mapOriginY = 0;
if (mMapImage)
{
if (mMapImage->getWidth() > a.width ||
mMapImage->getHeight() > a.height)
{
- mapOriginX += ((a.width) / 2) - (player_node->mX * mProportion);
- mapOriginY += ((a.height) / 2) - (player_node->mY * mProportion);
+ mapOriginX = ((a.width) / 2) - (player_node->mX * mProportion);
+ mapOriginY = ((a.height) / 2) - (player_node->mY * mProportion);
- const int minOriginX = a.x + a.width - mMapImage->getWidth();
- const int minOriginY = a.y + a.height - mMapImage->getHeight();
+ const int minOriginX = a.width - mMapImage->getWidth();
+ const int minOriginY = 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;
+ if (mapOriginX > 0)
+ mapOriginX = 0;
+ if (mapOriginY > 0)
+ mapOriginY = 0;
}
static_cast<Graphics*>(graphics)->
@@ -140,4 +142,6 @@ void Minimap::draw(gcn::Graphics *graphics)
(int) (being->mY * mProportion) + mapOriginY - offset,
dotSize, dotSize));
}
+
+ graphics->popClipArea();
}