From 0a30bd1b2e2f02b6f34225d8976f645c99b53b7e Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Fri, 20 Nov 2015 08:47:34 -0500 Subject: Started inv ui, new item system --- src/inventory.cpp | 66 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 30 deletions(-) (limited to 'src/inventory.cpp') diff --git a/src/inventory.cpp b/src/inventory.cpp index 217fd18..edc88ff 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -2,21 +2,10 @@ #include #include -#define ITEM_COUNT 2 // Total number of items that actually exist +#define ITEM_COUNT 5 // Total number of items that actually exist extern Player *player; - -const char *itemName[]={ - "\0", - "Dank Maymay", - "Sword" -}; - -const char *ITEM_SPRITE[]={ - "\0", // Null - "assets/items/ITEM_TEST.png", // Dank maymay - "assets/items/ITEM_SWORD.png" -}; +extern GLuint invUI; GLuint *ITEM_TEX; @@ -26,7 +15,7 @@ unsigned int initInventorySprites(void){ unsigned int i,loadCount=0; ITEM_TEX=(GLuint *)calloc(ITEM_COUNT,sizeof(GLuint)); for(i=0;iinv->tossd) yes=true; glBegin(GL_QUADS); - glTexCoord2i(0,1);glVertex2f(item_coord.x+p1.x,item_coord.y+p2.y); - glTexCoord2i(1,1);glVertex2f(item_coord.x+p2.x,item_coord.y+p2.y); - glTexCoord2i(1,0);glVertex2f(item_coord.x+p2.x,item_coord.y+p1.y); - glTexCoord2i(0,0);glVertex2f(item_coord.x+p1.x,item_coord.y+p1.y); + glTexCoord2i(0,1);glVertex2f(item_coord.x+p->loc.x, item_coord.y+p->loc.y); + glTexCoord2i(1,1);glVertex2f(item_coord.x+item[sel].width+p->loc.x, item_coord.y+p->loc.y); + glTexCoord2i(1,0);glVertex2f(item_coord.x+item[sel].width+p->loc.x, item_coord.y+item[sel].height+p->loc.y); + glTexCoord2i(0,0);glVertex2f(item_coord.x+p->loc.x, item_coord.y+item[sel].height+p->loc.y); glEnd(); glDisable(GL_TEXTURE_2D); } @@ -143,8 +146,11 @@ void itemDraw(Player *p,ITEM_ID id){ int Inventory::useItem(void){ ITEM_ID id = item[sel].id; switch(id){ + case SWORD_WOOD: + + break; default: - ui::dialogBox(itemName[id],NULL,"You cannot use this item."); + ui::dialogBox(item[id].name,NULL,"You cannot use this item."); break; } return 0; -- cgit v1.2.3