diff options
author | Kahrl <kahrl@gmx.net> | 2012-01-12 08:47:17 +0100 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2012-01-12 08:47:17 +0100 |
commit | a58d7255698f9a5e3e13f9cb0b8500988d12dd10 (patch) | |
tree | 956430f7ec5ffba3cf2de833d41605035b74b8e1 /src | |
parent | 6a76c226e10e92c3e3339096f07f8ab065e2098b (diff) | |
download | minetest-a58d7255698f9a5e3e13f9cb0b8500988d12dd10.tar.gz minetest-a58d7255698f9a5e3e13f9cb0b8500988d12dd10.tar.bz2 minetest-a58d7255698f9a5e3e13f9cb0b8500988d12dd10.zip |
Tool progress bar tweaking
Diffstat (limited to 'src')
-rw-r--r-- | src/guiInventoryMenu.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/guiInventoryMenu.cpp b/src/guiInventoryMenu.cpp index 9b2aed377..f2a644e80 100644 --- a/src/guiInventoryMenu.cpp +++ b/src/guiInventoryMenu.cpp @@ -68,7 +68,7 @@ void drawItemStack(video::IVideoDriver *driver, // Shrink progressrect by amount of tool damage float wear = item.wear / 65535.0; - progressrect.LowerRightCorner.X = + int progressmid = wear * progressrect.UpperLeftCorner.X + (1-wear) * progressrect.LowerRightCorner.X; @@ -77,14 +77,21 @@ void drawItemStack(video::IVideoDriver *driver, // wear = 0.5: yellow // wear = 1.0: red video::SColor color(255,255,255,255); - int wear_i = floor(wear * 511); + int wear_i = MYMIN(floor(wear * 600), 511); wear_i = MYMIN(wear_i + 10, 511); if(wear_i <= 255) color.set(255, wear_i, 255, 0); else color.set(255, 255, 511-wear_i, 0); - driver->draw2DRectangle(color, progressrect, clip); + core::rect<s32> progressrect2 = progressrect; + progressrect2.LowerRightCorner.X = progressmid; + driver->draw2DRectangle(color, progressrect2, clip); + + color = video::SColor(255,0,0,0); + progressrect2 = progressrect; + progressrect2.UpperLeftCorner.X = progressmid; + driver->draw2DRectangle(color, progressrect2, clip); } if(font != NULL && item.count >= 2) |