diff options
author | Fate <fate-tmw@googlemail.com> | 2008-11-23 11:52:51 -0700 |
---|---|---|
committer | Fate <fate-tmw@googlemail.com> | 2008-11-23 11:52:51 -0700 |
commit | ba0d53c6234562b1826dfeb58d02e49757c2ce5b (patch) | |
tree | 2134447b73b89215c824dde6e6d520bbe35c8083 /src/gui/minimap.cpp | |
parent | d011f8f984f454a76adaf04142df0daa03dd00a8 (diff) | |
parent | 31f40703d569478619952343bde3f73c3a576847 (diff) | |
download | mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.tar.gz mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.tar.bz2 mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.tar.xz mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.zip |
Merge branch '0.0' of git@gitorious.org:tmw/mainline into 0.0
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r-- | src/gui/minimap.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index c17fa06b..f07cb417 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -17,8 +17,6 @@ * You should have received a copy of the GNU General Public License * along with The Mana World; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ */ #include "minimap.h" @@ -42,42 +40,47 @@ Minimap::Minimap(): Minimap::~Minimap() { if (mMapImage) - { mMapImage->decRef(); - } } void Minimap::setMapImage(Image *img) { if (mMapImage) - { mMapImage->decRef(); - } mMapImage = img; if (mMapImage) - { mMapImage->setAlpha(0.7); - } } 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()) { @@ -103,11 +106,10 @@ void Minimap::draw(gcn::Graphics *graphics) continue; } - int offset = (dotSize - 1) / 2; - + const int offset = (dotSize - 1) / 2; graphics->fillRectangle(gcn::Rectangle( - being->mX / 2 + getPadding() - offset, - being->mY / 2 + getTitleBarHeight() - offset, + being->mX / 2 + mapOriginX - offset, + being->mY / 2 + mapOriginY - offset, dotSize, dotSize)); } } |