diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itemcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemshortcutcontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 27 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.h | 2 |
5 files changed, 26 insertions, 13 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 30cb1d6d..5069e102 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -206,7 +206,7 @@ ItemContainer::mousePressed(gcn::MouseEvent &event) } Item *item = mInventory->getItem(index); setSelectedItem(item); - if (item && !item->isEquipment()) + if (item) { itemShortcut->setItemSelected(item->getId()); } diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp index 86a53aca..f8a0959a 100644 --- a/src/gui/itemshortcutcontainer.cpp +++ b/src/gui/itemshortcutcontainer.cpp @@ -96,11 +96,13 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics) player_node->getInventory()->findItem(itemShortcut->getItem(i)); if (item) { // Draw item icon. + const std::string label = + item->isEquipped() ? "Eq." : toString(item->getQuantity()); Image* image = item->getImage(); if (image) { g->drawImage(image, itemX, itemY); g->drawText( - toString(item->getQuantity()), + label, itemX + mBoxWidth / 2, itemY + mBoxHeight - 14, gcn::Graphics::CENTER); 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)); } } diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index e8b50dc9..87527f0a 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -31,13 +31,13 @@ Image *ResizeGrip::gripImage = 0; int ResizeGrip::mInstances = 0; -ResizeGrip::ResizeGrip() +ResizeGrip::ResizeGrip(std::string image) { if (mInstances == 0) { // Load the grip image ResourceManager *resman = ResourceManager::getInstance(); - gripImage = resman->getImage("graphics/gui/resize.png"); + gripImage = resman->getImage(image); } mInstances++; diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h index 5f3a09a4..acb934d2 100644 --- a/src/gui/widgets/resizegrip.h +++ b/src/gui/widgets/resizegrip.h @@ -41,7 +41,7 @@ class ResizeGrip : public gcn::Widget /** * Constructor. */ - ResizeGrip(); + ResizeGrip(std::string image = "graphics/gui/resize.png"); /** * Destructor. |