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
};
void itemUse(void *p);
+void initInventorySprites(void);
char *getItemTexturePath(ITEM_ID id);
#endif // INVENTORY_H
invUI = Texture::loadTexture("assets/invUI.png" );
- //std::cout << "Before invSprites\n";
- //initInventorySprites();
- //std::cout << "After invSprites\n";
-
+ initInventorySprites();
+
/**************************
**** GAMELOOP ****
**************************/
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;
}
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){
}
void Inventory::draw(void){
- std::cout << invHover << std::endl;
unsigned int i=0;
static unsigned int lop = 0;
float y,xoff;
* 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);
/*