diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-28 00:18:59 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-28 00:18:59 +0000 |
commit | 4525bedabcf5796da0d7923a014bbdc18fee429e (patch) | |
tree | 81e2ac034886fffcb3b9d17699a57dbe87d37aa0 /src/gui | |
parent | 30063f42cc8d13ed241a52b90e63c2c68599115e (diff) | |
download | mana-4525bedabcf5796da0d7923a014bbdc18fee429e.tar.gz mana-4525bedabcf5796da0d7923a014bbdc18fee429e.tar.bz2 mana-4525bedabcf5796da0d7923a014bbdc18fee429e.tar.xz mana-4525bedabcf5796da0d7923a014bbdc18fee429e.zip |
Applied inventory weight information patch by Javila.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/inventory.cpp | 17 | ||||
-rw-r--r-- | src/gui/inventory.h | 4 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 95cc4bd3..66ccff58 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -36,7 +36,7 @@ InventoryWindow::InventoryWindow(): Window("Inventory") { - setContentSize(322, 150); + setContentSize(322, 160); useButton = new Button("Use"); dropButton = new Button("Drop"); @@ -51,12 +51,17 @@ InventoryWindow::InventoryWindow(): itemNameLabel = new gcn::Label("Name:"); itemDescriptionLabel = new gcn::Label("Description:"); + weightLabel = new gcn::Label("Total Weight: - Maximum Weight: "); + weightLabel->setPosition(8, 8); + invenScroll->setPosition(8, + weightLabel->getY() + weightLabel->getHeight() + 5); add(useButton); add(dropButton); add(invenScroll); add(itemNameLabel); add(itemDescriptionLabel); + add(weightLabel); setResizeable(true); setMinWidth(240); @@ -74,6 +79,7 @@ InventoryWindow::~InventoryWindow() delete items; delete itemNameLabel; delete itemDescriptionLabel; + delete weightLabel; } void InventoryWindow::logic() @@ -83,6 +89,13 @@ void InventoryWindow::logic() // It would be nicer if this update could be event based, needs some // redesign of InventoryWindow and ItemContainer probably. updateButtons(); + + // Update weight information + char tempstr[128]; + sprintf(tempstr, "Total Weight: %2i - Maximum Weight: %2i", + char_info->totalWeight, char_info->maxWeight); + weightLabel->setCaption(tempstr); + weightLabel->adjustSize(); } int InventoryWindow::addItem(int index, int id, int quantity, bool equipment) @@ -207,7 +220,7 @@ void InventoryWindow::updateWidgets() dropButton->setPosition(48 + 16, getHeight() - 24); items->setSize(getWidth() - 24 - 12 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1); - invenScroll->setSize(getWidth() - 16, getHeight() - 72); + invenScroll->setSize(getWidth() - 16, getHeight() - 90); itemNameLabel->setPosition(8, invenScroll->getY() + invenScroll->getHeight() + 4); itemDescriptionLabel->setPosition(8, diff --git a/src/gui/inventory.h b/src/gui/inventory.h index 37edff7f..969424fb 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -51,7 +51,7 @@ class InventoryWindow : public Window, gcn::ActionListener ~InventoryWindow(); /** - * Logic (updates buttons) + * Logic (updates buttons and weight information) */ void logic(); @@ -93,6 +93,7 @@ class InventoryWindow : public Window, gcn::ActionListener int dropItem(int index, int quantity); void mouseClick(int x, int y, int button, int count); + void mouseMotion(int mx, int my); ItemContainer *items; @@ -107,6 +108,7 @@ class InventoryWindow : public Window, gcn::ActionListener gcn::Label *itemNameLabel; gcn::Label *itemDescriptionLabel; + gcn::Label *weightLabel; }; #endif |