From 705de63dcdfe78157234e1b65652d5c2f762dbd4 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 24 Dec 2010 11:44:26 +0200 Subject: ProgressBarTextureMod --- src/inventory.h | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index e97db8ffb..fd2cd8778 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -226,17 +226,39 @@ public: #ifndef SERVER video::ITexture * getImage() { + std::string basename; if(m_toolname == "WPick") - return g_irrlicht->getTexture("../data/tool_wpick.png"); - if(m_toolname == "STPick") - return g_irrlicht->getTexture("../data/tool_stpick.png"); + basename = "../data/tool_wpick.png"; + else if(m_toolname == "STPick") + basename = "../data/tool_stpick.png"; // Default to cloud texture - return g_irrlicht->getTexture(tile_texture_path_get(TILE_CLOUD)); + else + basename = tile_texture_path_get(TILE_CLOUD); + + /* + Calculate some progress value with sane amount of + maximum states + */ + u32 maxprogress = 30; + u32 toolprogress = (65535-m_wear)/(65535/maxprogress); + + // Make texture name for the new texture with a progress bar + std::ostringstream os; + os<getTexture(TextureSpec(finalname, basename, mod)); } #endif std::string getText() { - std::ostringstream os; + return ""; + + /*std::ostringstream os; u16 f = 4; u16 d = 65535/f; u16 i; @@ -244,7 +266,7 @@ public: os<<'X'; for(; i