summaryrefslogtreecommitdiff
path: root/src/gui/equipment.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-02-20 11:32:50 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-02-20 11:32:50 +0000
commit3135c725cc37251943271cd8f939e646c9164259 (patch)
tree159ae31b1c0518d37f5bb21344fe3c72bf5cc382 /src/gui/equipment.cpp
parent54a359f67da79d97df667299ea4d91cef79c08f2 (diff)
downloadmana-3135c725cc37251943271cd8f939e646c9164259.tar.gz
mana-3135c725cc37251943271cd8f939e646c9164259.tar.bz2
mana-3135c725cc37251943271cd8f939e646c9164259.tar.xz
mana-3135c725cc37251943271cd8f939e646c9164259.zip
Finally equipment! Sometimes it works :P
Diffstat (limited to 'src/gui/equipment.cpp')
-rw-r--r--src/gui/equipment.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gui/equipment.cpp b/src/gui/equipment.cpp
index c34a9b30..ccc4d403 100644
--- a/src/gui/equipment.cpp
+++ b/src/gui/equipment.cpp
@@ -29,10 +29,17 @@
EquipmentWindow::EquipmentWindow():
Window("Equipment")
{
- setSize(300, 300);
+ setSize(70, 200);
setPosition(40, 40);
+ ResourceManager *resman = ResourceManager::getInstance();
+ Image *itemImg = resman->getImage("core/graphics/sprites/items.png");
+ if (!itemImg) error("Unable to load items.png");
+ itemset = new Spriteset(itemImg, 20, 20);
+ for (int i = 0; i < 10; i++ ) {
+ equipments[i] = 0;
+ }
}
EquipmentWindow::~EquipmentWindow()
@@ -41,10 +48,29 @@ EquipmentWindow::~EquipmentWindow()
void EquipmentWindow::draw(gcn::Graphics *graphics)
{
+ int x, y;
+ getAbsolutePosition(x, y);
+
// Draw window graphics
Window::draw(graphics);
+
+ for (int i = 0; i < 10; i++) {
+ if (equipments[i] > 0) {
+ itemset->spriteset[equipments[i] - 501]->draw(screen,
+ x + 20, y + 24 * i);
+ }
+ }
}
void EquipmentWindow::action(const std::string &eventId)
{
}
+
+void EquipmentWindow::addEquipment(int index, int id) {
+ equipments[index] = id;
+}
+
+void EquipmentWindow::removeEquipment(int index) {
+ equipments[index] = 0;
+}
+