aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/inventory.h3
-rw-r--r--main.cpp6
-rw-r--r--src/inventory.cpp10
-rw-r--r--src/ui.cpp6
4 files changed, 12 insertions, 13 deletions
diff --git a/include/inventory.h b/include/inventory.h
index 18ef6c4..1ad46d0 100644
--- a/include/inventory.h
+++ b/include/inventory.h
@@ -39,8 +39,6 @@ enum ITEM_TYPE{
class Item{
protected:
public:
- friend class Inventory;
- friend unsigned int initInventorySprites(void);
ITEM_ID id; // ID of the item
char *name;
ITEM_TYPE type; // What category the item falls under
@@ -89,6 +87,7 @@ public:
};
void itemUse(void *p);
+void initInventorySprites(void);
char *getItemTexturePath(ITEM_ID id);
#endif // INVENTORY_H
diff --git a/main.cpp b/main.cpp
index 19d67e7..f24b9bd 100644
--- a/main.cpp
+++ b/main.cpp
@@ -434,10 +434,8 @@ int main(int argc, char *argv[]){
invUI = Texture::loadTexture("assets/invUI.png" );
- //std::cout << "Before invSprites\n";
- //initInventorySprites();
- //std::cout << "After invSprites\n";
-
+ initInventorySprites();
+
/**************************
**** GAMELOOP ****
**************************/
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 73e5e32..0eac3b2 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -15,6 +15,12 @@ static GLuint itemtex[ITEM_COUNT];
void itemDraw(Player *p,ITEM_ID id);
+void initInventorySprites(void){
+ for(int i = 0;i<ITEM_COUNT;i++){
+ itemtex[i]=Texture::loadTexture(getItemTexturePath((ITEM_ID)i));
+ }
+}
+
char *getItemTexturePath(ITEM_ID id){
return item[id].textureLoc;
}
@@ -41,9 +47,6 @@ Inventory::Inventory(unsigned int s){
size=s;
inv = new struct item_t[size];
memset(inv,0,size*sizeof(struct item_t));
- for(int i = 0;i<ITEM_COUNT;i++){
- itemtex[i]=Texture::loadTexture(getItemTexturePath((ITEM_ID)i));
- }
}
Inventory::~Inventory(void){
@@ -90,7 +93,6 @@ int Inventory::takeItem(ITEM_ID id,unsigned char count){
}
void Inventory::draw(void){
- std::cout << invHover << std::endl;
unsigned int i=0;
static unsigned int lop = 0;
float y,xoff;
diff --git a/src/ui.cpp b/src/ui.cpp
index 181803d..e9b262f 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -354,15 +354,15 @@ namespace ui {
* Create a wimpy buffer.
*/
- buf = new char[128]; //(char *)calloc(128,sizeof(char));
- memset(buf,0,128*sizeof(char));
+ buf = new char[512]; //(char *)calloc(128,sizeof(char));
+ memset(buf,0,512*sizeof(char));
/*
* Handle the formatted string, printing it to the buffer.
*/
va_start(args,str);
- vsnprintf(buf,128,str,args);
+ vsnprintf(buf,512,str,args);
va_end(args);
/*