aboutsummaryrefslogtreecommitdiffstats
path: root/include/inventory.h
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-11-30 07:29:39 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-11-30 07:29:39 -0500
commite21db32169966b983e09b53801ee1a6d3101e57e (patch)
tree09093d48beb705e2907a27f0ffb99c3ab9b20706 /include/inventory.h
parent19ef54b2c5ffcaefdce352c6f195a62c05c42767 (diff)
Look at my fancy inventory
Diffstat (limited to 'include/inventory.h')
-rw-r--r--include/inventory.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/include/inventory.h b/include/inventory.h
index dc5c04e..3fdbf52 100644
--- a/include/inventory.h
+++ b/include/inventory.h
@@ -2,6 +2,7 @@
#define INVENTORY_H
#include <common.h>
+#include <string.h>
#define DEBUG
@@ -19,8 +20,6 @@
* A list of all item IDs.
*/
-static unsigned int sel;
-
enum ITEM_ID {
DEBUG_ITEM = 69,
TEST_ITEM = 1,
@@ -49,15 +48,23 @@ public:
float height;
int maxStackSize;
char* textureLoc;
+ Texturec *tex;
int count;
Item(ITEM_ID i, char* n, ITEM_TYPE t, float w, float h, int m, char* tl):
- id(i), name(n), type(t), width(w), height(h), maxStackSize(m), textureLoc(tl){
+ id(i), type(t), width(w), height(h), maxStackSize(m){
count = 0;
+
+ name = (char*)calloc(strlen(n ),sizeof(char));
+ textureLoc = (char*)calloc(strlen(tl),sizeof(char));
+
+ strcpy(name,n);
+ strcpy(textureLoc,tl);
+
+ tex= new Texturec(1,textureLoc);
}
- void addCount(int c){
- count += c;
+ GLuint rtex(){
+ return tex->image[0];
}
-
};
static Item item[5]= {
@@ -66,20 +73,20 @@ static Item item[5]= {
struct item_t{
int count;
- ITEM_ID itmid;
- void addC(int c, ITEM_ID i){
- count = c;
- itmid = i;
- item[itmid].addCount(count);
- }
+ ITEM_ID id;
} __attribute__((packed));
class Inventory {
private:
unsigned int size; // Size of 'item' array
+ item_t *inv;
+ int os = 0;
//struct item_t *item; // An array of the items contained in this inventory.
public:
+ unsigned int sel;
+ bool invOpen = false;
+ bool invOpening = false;
Inventory(unsigned int s); // Creates an inventory of size 's'
~Inventory(void); // Free's 'item'
@@ -97,7 +104,6 @@ public:
};
-unsigned int initInventorySprites(void); // Loads as many inventory textures as it can find, returns count
void itemUse(void *p);
#endif // INVENTORY_H