diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-22 13:12:46 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-22 13:12:46 +0000 |
commit | 09f8e3e9d9c6ca2bc39c3178c4f21b027ac07bcb (patch) | |
tree | 73e0da7b621cebe406e3b456388a4d261f8b170b /src/gui/equipment.cpp | |
parent | 00b3b347f845f8b1550777f09464463af3805098 (diff) | |
download | mana-09f8e3e9d9c6ca2bc39c3178c4f21b027ac07bcb.tar.gz mana-09f8e3e9d9c6ca2bc39c3178c4f21b027ac07bcb.tar.bz2 mana-09f8e3e9d9c6ca2bc39c3178c4f21b027ac07bcb.tar.xz mana-09f8e3e9d9c6ca2bc39c3178c4f21b027ac07bcb.zip |
New equipment window layout and some improvements to equip management
Diffstat (limited to 'src/gui/equipment.cpp')
-rw-r--r-- | src/gui/equipment.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/gui/equipment.cpp b/src/gui/equipment.cpp index 95e9998c..e55b01b6 100644 --- a/src/gui/equipment.cpp +++ b/src/gui/equipment.cpp @@ -27,10 +27,12 @@ #include "../resources/resourcemanager.h" #include "../resources/image.h" +#include <sstream> + EquipmentWindow::EquipmentWindow(): - Window("Equipment") + Window("Equipment"), arrows(0) { - setContentSize(60, 200); + setContentSize(134, 60); setPosition(40, 40); ResourceManager *resman = ResourceManager::getInstance(); @@ -60,12 +62,21 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) if (equipments[i].id > 0) { itemset->spriteset[itemDb.getItemInfo( equipments[i].id)->getImage() - 1]->draw( - screen, x + 22, y + 24 * i + 20); + screen, x + 24 * (i % 4) + 10, y + 24 * (i / 4) + 25); } graphics->setColor(gcn::Color(0, 0, 0)); - graphics->drawRectangle(gcn::Rectangle(22, 24 * i + 20, 20, 20)); - - + graphics->drawRectangle(gcn::Rectangle(10 + 24 * (i % 4), + 24 * (i / 4) + 25, 20, 20)); + } + graphics->setColor(gcn::Color(0, 0, 0)); + graphics->drawRectangle(gcn::Rectangle(110, 25, 20, 20)); + if (arrows) { + itemset->spriteset[itemDb.getItemInfo(arrows)->getImage() - 1]->draw( + screen, x + 110, y + 25); + std::stringstream n; + n << arrowsNumber; + graphics->drawText(n.str(), 120, 50, + gcn::Graphics::CENTER); } } @@ -73,19 +84,27 @@ void EquipmentWindow::action(const std::string &eventId) { } -void EquipmentWindow::addEquipment(int index, int id) { +void EquipmentWindow::addEquipment(int index, int id) +{ equipments[index].id = id; } -void EquipmentWindow::removeEquipment(int index) { +void EquipmentWindow::removeEquipment(int index) +{ equipments[index].id = 0; } -void EquipmentWindow::setInventoryIndex(int index, int inventoryIndex) { +void EquipmentWindow::setInventoryIndex(int index, int inventoryIndex) +{ equipments[index].inventoryIndex = inventoryIndex; } -int EquipmentWindow::getInventoryIndex(int index) { +int EquipmentWindow::getInventoryIndex(int index) +{ return equipments[index].inventoryIndex; } +void EquipmentWindow::setArrows(int id) +{ + arrows = id; +} |