aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-05-11 13:26:23 +0200
committersapier <Sapier at GMX dot net>2014-05-11 13:26:23 +0200
commitb16cbba21a60de8d3b6e0b2b2caf0a529a0fecd9 (patch)
tree2c8db0b0a17ccefcff0228c11de47eb404dfc87c /src
parent90f0859128774fdf270821e53fca5eabc0c5b8bf (diff)
downloadminetest-b16cbba21a60de8d3b6e0b2b2caf0a529a0fecd9.tar.gz
minetest-b16cbba21a60de8d3b6e0b2b2caf0a529a0fecd9.tar.bz2
minetest-b16cbba21a60de8d3b6e0b2b2caf0a529a0fecd9.zip
Fix incorrect scaling of customized hud item selection marker
Diffstat (limited to 'src')
-rw-r--r--src/hud.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/hud.cpp b/src/hud.cpp
index 7f2f4276c..f1d7a3258 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -83,17 +83,18 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
void Hud::drawItem(const ItemStack &item, const core::rect<s32>& rect, bool selected) {
if (selected) {
+ /* draw hihlighting around selected item */
if (use_hotbar_selected_image) {
- core::rect<s32> imgrect2 = rect;
- imgrect2.UpperLeftCorner.X -= m_padding;
- imgrect2.UpperLeftCorner.Y -= m_padding;
- imgrect2.LowerRightCorner.X += m_padding;
- imgrect2.LowerRightCorner.Y += m_padding;
- video::ITexture *texture = tsrc->getTexture(hotbar_selected_image);
- core::dimension2di imgsize(texture->getOriginalSize());
- driver->draw2DImage(texture, imgrect2,
- core::rect<s32>(core::position2d<s32>(0,0), imgsize),
- NULL, hbar_colors, true);
+ core::rect<s32> imgrect2 = rect;
+ imgrect2.UpperLeftCorner.X -= (m_padding*2);
+ imgrect2.UpperLeftCorner.Y -= (m_padding*2);
+ imgrect2.LowerRightCorner.X += (m_padding*2);
+ imgrect2.LowerRightCorner.Y += (m_padding*2);
+ video::ITexture *texture = tsrc->getTexture(hotbar_selected_image);
+ core::dimension2di imgsize(texture->getOriginalSize());
+ driver->draw2DImage(texture, imgrect2,
+ core::rect<s32>(core::position2d<s32>(0,0), imgsize),
+ NULL, hbar_colors, true);
} else {
video::SColor c_outside(255,255,0,0);
//video::SColor c_outside(255,0,0,0);
@@ -185,8 +186,10 @@ void Hud::drawItems(v2s32 upperleftpos, s32 itemcount, s32 offset,
use_hotbar_selected_image = false;
}
+ /* draw customized item background */
if (use_hotbar_image) {
- core::rect<s32> imgrect2(-m_padding/2, -m_padding/2, width+m_padding/2, height+m_padding/2);
+ core::rect<s32> imgrect2(-m_padding/2, -m_padding/2,
+ width+m_padding/2, height+m_padding/2);
core::rect<s32> rect2 = imgrect2 + pos;
video::ITexture *texture = tsrc->getTexture(hotbar_image);
core::dimension2di imgsize(texture->getOriginalSize());