add an inventory status indicator

This commit is contained in:
darkrose 2015-03-19 21:28:48 +10:00
parent b084a4755c
commit b5e07ffccd
4 changed files with 38 additions and 0 deletions

BIN
data/textures/inventory.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

View File

@ -506,6 +506,44 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
}
}
// inventory status
{
const char* states[3] = {
"inventory.png",
"inventory_full.png",
"inventory_max.png"
};
int state = 2;
{
u32 count = mainlist->getSize();
for (u32 i=0; i<count; i++) {
InventoryItem *item = mainlist->getItem(i);
if (!item) {
state = 0;
break;
}
if (state == 2 && item->freeSpace())
state = 1;
}
}
const video::SColor color(255,255,255,255);
const video::SColor colors[] = {color,color,color,color};
video::ITexture *texture = driver->getTexture(getTexturePath(states[state]).c_str());
core::rect<s32> rect(screensize.X-51,screensize.Y-186,screensize.X-19,screensize.Y-154);
driver->draw2DImage(
texture,
rect,
core::rect<s32>(
core::position2d<s32>(0,0),
core::dimension2di(texture->getOriginalSize())
),
NULL,
colors,
true
);
}
// health
if (halfheartcount) {
int c = 55+(halfheartcount*10);