summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/equipment.cpp39
-rw-r--r--src/gui/equipment.h6
2 files changed, 34 insertions, 11 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;
+}
diff --git a/src/gui/equipment.h b/src/gui/equipment.h
index 7a945f4c..8dde09d6 100644
--- a/src/gui/equipment.h
+++ b/src/gui/equipment.h
@@ -68,10 +68,14 @@ class EquipmentWindow : public Window, gcn::ActionListener {
int getInventoryIndex(int index);
+ void setArrows(int id);
+
EQUIPMENT_HOLDER equipments[10];
- private:
+ int arrowsNumber;
+ private:
+ int arrows;
Spriteset *itemset;
};