diff options
author | Andy <drumsetmonkey@gmail.com> | 2017-01-19 09:21:12 -0500 |
---|---|---|
committer | Andy <drumsetmonkey@gmail.com> | 2017-01-19 09:21:12 -0500 |
commit | 213d9ccfbb4752d4c62d6b7e6b3f9172cdf1bccc (patch) | |
tree | 7872c6f30c8adf048a7863a33d837299c7fb0771 /include/inventory.hpp | |
parent | 19a32074595a4a2797eaeb978f8bd302f736f6a6 (diff) | |
parent | 8452b199d28bea53bf2c5e3b3d604064000fc73d (diff) |
Limb animation actually works
Diffstat (limited to 'include/inventory.hpp')
-rw-r--r-- | include/inventory.hpp | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/include/inventory.hpp b/include/inventory.hpp index fa24de4..44ed148 100644 --- a/include/inventory.hpp +++ b/include/inventory.hpp @@ -7,29 +7,57 @@ #include <events.hpp> struct Item { - GLuint icon; + 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")); + } }; -using InventoryEntry = std::pair<Item, unsigned int>; +struct InventoryEntry { + Item* item; + int count; + 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; - unsigned int maxItemCount; public: - InventorySystem(unsigned int mic = 1) - : maxItemCount(mic) {} + InventorySystem(int size = 4) { + items.resize(size); + loadItems(); + } void configure(entityx::EventManager &ev); - void loadIcons(void); + void loadItems(void); void update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) override; void receive(const KeyDownEvent &kde); + void render(void); + + void add(const std::string& name, int count); }; #endif // INVENTORY_HPP_ |