diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/inventory.hpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/include/inventory.hpp b/include/inventory.hpp index 15877e9..44ed148 100644 --- a/include/inventory.hpp +++ b/include/inventory.hpp @@ -6,20 +6,40 @@ #include <components.hpp> #include <events.hpp> -struct InventoryEntry { - GLuint icon; +struct Item { std::string name; std::string type; + int value; + int stackSize; + Texture sprite; + + Item(void) + : value(0), stackSize(1) {} + + Item(XMLElement *e) { + name = e->StrAttribute("name"); + type = e->StrAttribute("type"); + + value = 0; + e->QueryIntAttribute("value", &value); + stackSize = 1; + e->QueryIntAttribute("maxStackSize", &stackSize); + + sprite = Texture(e->StrAttribute("sprite")); + } +}; +struct InventoryEntry { + Item* item; int count; - int max; vec2 loc; + + InventoryEntry(void) + : item(nullptr), count(0) {} }; class InventorySystem : public entityx::System<InventorySystem>, public entityx::Receiver<InventorySystem> { private: - entityx::Entity currentItemEntity; - std::vector<InventoryEntry> items; public: @@ -36,6 +56,8 @@ public: void receive(const KeyDownEvent &kde); void render(void); + + void add(const std::string& name, int count); }; #endif // INVENTORY_HPP_ |