From: Loïc Blot Date: Mon, 19 Jun 2017 13:20:30 +0000 (+0200) Subject: hud.cpp: fix wrong indent in drawItem X-Git-Tag: 5.0.0~1090 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=53acc32bee75e6eb8788ab5eb926243648ad191c;p=oweals%2Fminetest.git hud.cpp: fix wrong indent in drawItem --- diff --git a/src/hud.cpp b/src/hud.cpp index b030215d4..1b3b2f264 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -120,79 +120,79 @@ void Hud::drawItem(const ItemStack &item, const core::rect& rect, bool selected) { if (selected) { - /* draw hihlighting around selected item */ - if (use_hotbar_selected_image) { - core::rect 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()); - draw2DImageFilterScaled(driver, texture, imgrect2, - core::rect(core::position2d(0,0), imgsize), - NULL, hbar_colors, true); - } else { - video::SColor c_outside(255,255,0,0); - //video::SColor c_outside(255,0,0,0); - //video::SColor c_inside(255,192,192,192); - s32 x1 = rect.UpperLeftCorner.X; - s32 y1 = rect.UpperLeftCorner.Y; - s32 x2 = rect.LowerRightCorner.X; - s32 y2 = rect.LowerRightCorner.Y; - // Black base borders - driver->draw2DRectangle(c_outside, - core::rect( - v2s32(x1 - m_padding, y1 - m_padding), - v2s32(x2 + m_padding, y1) - ), NULL); - driver->draw2DRectangle(c_outside, - core::rect( - v2s32(x1 - m_padding, y2), - v2s32(x2 + m_padding, y2 + m_padding) - ), NULL); - driver->draw2DRectangle(c_outside, - core::rect( - v2s32(x1 - m_padding, y1), - v2s32(x1, y2) - ), NULL); - driver->draw2DRectangle(c_outside, - core::rect( - v2s32(x2, y1), - v2s32(x2 + m_padding, y2) - ), NULL); - /*// Light inside borders - driver->draw2DRectangle(c_inside, - core::rect( - v2s32(x1 - padding/2, y1 - padding/2), - v2s32(x2 + padding/2, y1) - ), NULL); - driver->draw2DRectangle(c_inside, - core::rect( - v2s32(x1 - padding/2, y2), - v2s32(x2 + padding/2, y2 + padding/2) - ), NULL); - driver->draw2DRectangle(c_inside, - core::rect( - v2s32(x1 - padding/2, y1), - v2s32(x1, y2) - ), NULL); - driver->draw2DRectangle(c_inside, - core::rect( - v2s32(x2, y1), - v2s32(x2 + padding/2, y2) - ), NULL); - */ - } + /* draw hihlighting around selected item */ + if (use_hotbar_selected_image) { + core::rect 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()); + draw2DImageFilterScaled(driver, texture, imgrect2, + core::rect(core::position2d(0,0), imgsize), + NULL, hbar_colors, true); + } else { + video::SColor c_outside(255,255,0,0); + //video::SColor c_outside(255,0,0,0); + //video::SColor c_inside(255,192,192,192); + s32 x1 = rect.UpperLeftCorner.X; + s32 y1 = rect.UpperLeftCorner.Y; + s32 x2 = rect.LowerRightCorner.X; + s32 y2 = rect.LowerRightCorner.Y; + // Black base borders + driver->draw2DRectangle(c_outside, + core::rect( + v2s32(x1 - m_padding, y1 - m_padding), + v2s32(x2 + m_padding, y1) + ), NULL); + driver->draw2DRectangle(c_outside, + core::rect( + v2s32(x1 - m_padding, y2), + v2s32(x2 + m_padding, y2 + m_padding) + ), NULL); + driver->draw2DRectangle(c_outside, + core::rect( + v2s32(x1 - m_padding, y1), + v2s32(x1, y2) + ), NULL); + driver->draw2DRectangle(c_outside, + core::rect( + v2s32(x2, y1), + v2s32(x2 + m_padding, y2) + ), NULL); + /*// Light inside borders + driver->draw2DRectangle(c_inside, + core::rect( + v2s32(x1 - padding/2, y1 - padding/2), + v2s32(x2 + padding/2, y1) + ), NULL); + driver->draw2DRectangle(c_inside, + core::rect( + v2s32(x1 - padding/2, y2), + v2s32(x2 + padding/2, y2 + padding/2) + ), NULL); + driver->draw2DRectangle(c_inside, + core::rect( + v2s32(x1 - padding/2, y1), + v2s32(x1, y2) + ), NULL); + driver->draw2DRectangle(c_inside, + core::rect( + v2s32(x2, y1), + v2s32(x2 + padding/2, y2) + ), NULL); + */ } - - video::SColor bgcolor2(128, 0, 0, 0); - if (!use_hotbar_image) - driver->draw2DRectangle(bgcolor2, rect, NULL); - drawItemStack(driver, g_fontengine->getFont(), item, rect, NULL, - client, selected ? IT_ROT_SELECTED : IT_ROT_NONE); } + video::SColor bgcolor2(128, 0, 0, 0); + if (!use_hotbar_image) + driver->draw2DRectangle(bgcolor2, rect, NULL); + drawItemStack(driver, g_fontengine->getFont(), item, rect, NULL, + client, selected ? IT_ROT_SELECTED : IT_ROT_NONE); +} + //NOTE: selectitem = 0 -> no selected; selectitem 1-based void Hud::drawItems(v2s32 upperleftpos, v2s32 screen_offset, s32 itemcount, s32 inv_offset, InventoryList *mainlist, u16 selectitem, u16 direction)