aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2017-01-18 06:46:36 -0500
committerClyne Sullivan <tullivan99@gmail.com>2017-01-18 06:46:36 -0500
commit8452b199d28bea53bf2c5e3b3d604064000fc73d (patch)
treefd3f6f2dbbf64329a1a17dee0cfdcddce4814f27 /include
parentd20633705e53a122467fb39fdbb2de3cfec279f7 (diff)
inventory bar
Diffstat (limited to 'include')
-rw-r--r--include/inventory.hpp32
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_