aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-12-03 09:29:46 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-12-03 09:29:46 -0500
commit8a342f76c838b8240d6d5fa99c624726e5d589a8 (patch)
tree566d2c037860ded5aac06ca333df9f0c55c4ca88
parent8a2f08dc35632a9a8e5272a629e0b4770d567c3a (diff)
parent3c8140152bcf72eb1d64b580bb9c1e139bcbe191 (diff)
Merge branch 'master' of http://github.com/tcsullivan/gamedev
-rw-r--r--include/inventory.h3
-rw-r--r--main.cpp6
-rw-r--r--src/inventory.cpp9
-rw-r--r--src/ui.cpp6
4 files changed, 12 insertions, 12 deletions
diff --git a/include/inventory.h b/include/inventory.h
index d28a930..2c667a7 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
@@ -92,6 +90,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 e364ce0..40f2153 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){
diff --git a/src/ui.cpp b/src/ui.cpp
index 31a9056..84ea2dc 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);
/*