diff options
author | Ira Rice <irarice@gmail.com> | 2008-11-25 18:43:28 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-11-25 18:43:28 +0000 |
commit | 886a5d4803e277b053014ae6b5c1c347f7756d48 (patch) | |
tree | e24d94a1652470c27a2dbe26eed7a1923d43adb3 /src/gui/minimap.cpp | |
parent | d5e30d8f72184241034aa797471c31a5bcbaa095 (diff) | |
download | mana-886a5d4803e277b053014ae6b5c1c347f7756d48.tar.gz mana-886a5d4803e277b053014ae6b5c1c347f7756d48.tar.bz2 mana-886a5d4803e277b053014ae6b5c1c347f7756d48.tar.xz mana-886a5d4803e277b053014ae6b5c1c347f7756d48.zip |
Miscellaneous TMW change commits. Missed these changes before because of
a confusion on git.
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r-- | src/gui/minimap.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 728f61e4..bd79ec87 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -70,18 +70,29 @@ void Minimap::draw(gcn::Graphics *graphics) { Window::draw(graphics); - if (mMapImage != NULL) + const gcn::Rectangle a = getChildrenArea(); + + int mapOriginX = a.x; + int mapOriginY = a.y; + + if (mMapImage) { + if (mMapImage->getWidth() > a.width || + mMapImage->getHeight() > a.height) + { + mapOriginX += (a.width - player_node->mX) / 2; + mapOriginY += (a.height - player_node->mY) / 2; + } static_cast<Graphics*>(graphics)-> - drawImage(mMapImage, getPadding(), getTitleBarHeight()); + drawImage(mMapImage, mapOriginX, mapOriginY); } - Beings &beings = beingManager->getAll(); - BeingIterator bi; + const Beings &beings = beingManager->getAll(); + Beings::const_iterator bi; for (bi = beings.begin(); bi != beings.end(); bi++) { - Being *being = (*bi); + const Being *being = (*bi); int dotSize = 2; switch (being->getType()) { @@ -107,11 +118,11 @@ void Minimap::draw(gcn::Graphics *graphics) continue; } - int offset = (dotSize - 1) * (int) mProportion; + const int offset = (dotSize - 1) * (int) mProportion; graphics->fillRectangle(gcn::Rectangle( - (being->mX * (int) mProportion) + getPadding() - offset, - (being->mY * (int) mProportion) + getTitleBarHeight() - offset, + (being->mX * (int) mProportion) + mapOriginX - offset, + (being->mY * (int) mProportion) + mapOriginY - offset, dotSize, dotSize)); } } |