hud.cpp: fix wrong indent in drawItem

This commit is contained in:
Loïc Blot 2017-06-19 15:20:30 +02:00
parent 4dcc5985df
commit 53acc32bee

@ -120,79 +120,79 @@ void Hud::drawItem(const ItemStack &item, const core::rect<s32>& rect,
bool selected) bool selected)
{ {
if (selected) { if (selected) {
/* draw hihlighting around selected item */ /* draw hihlighting around selected item */
if (use_hotbar_selected_image) { if (use_hotbar_selected_image) {
core::rect<s32> imgrect2 = rect; core::rect<s32> imgrect2 = rect;
imgrect2.UpperLeftCorner.X -= (m_padding*2); imgrect2.UpperLeftCorner.X -= (m_padding*2);
imgrect2.UpperLeftCorner.Y -= (m_padding*2); imgrect2.UpperLeftCorner.Y -= (m_padding*2);
imgrect2.LowerRightCorner.X += (m_padding*2); imgrect2.LowerRightCorner.X += (m_padding*2);
imgrect2.LowerRightCorner.Y += (m_padding*2); imgrect2.LowerRightCorner.Y += (m_padding*2);
video::ITexture *texture = tsrc->getTexture(hotbar_selected_image); video::ITexture *texture = tsrc->getTexture(hotbar_selected_image);
core::dimension2di imgsize(texture->getOriginalSize()); core::dimension2di imgsize(texture->getOriginalSize());
draw2DImageFilterScaled(driver, texture, imgrect2, draw2DImageFilterScaled(driver, texture, imgrect2,
core::rect<s32>(core::position2d<s32>(0,0), imgsize), core::rect<s32>(core::position2d<s32>(0,0), imgsize),
NULL, hbar_colors, true); NULL, hbar_colors, true);
} else { } else {
video::SColor c_outside(255,255,0,0); video::SColor c_outside(255,255,0,0);
//video::SColor c_outside(255,0,0,0); //video::SColor c_outside(255,0,0,0);
//video::SColor c_inside(255,192,192,192); //video::SColor c_inside(255,192,192,192);
s32 x1 = rect.UpperLeftCorner.X; s32 x1 = rect.UpperLeftCorner.X;
s32 y1 = rect.UpperLeftCorner.Y; s32 y1 = rect.UpperLeftCorner.Y;
s32 x2 = rect.LowerRightCorner.X; s32 x2 = rect.LowerRightCorner.X;
s32 y2 = rect.LowerRightCorner.Y; s32 y2 = rect.LowerRightCorner.Y;
// Black base borders // Black base borders
driver->draw2DRectangle(c_outside, driver->draw2DRectangle(c_outside,
core::rect<s32>( core::rect<s32>(
v2s32(x1 - m_padding, y1 - m_padding), v2s32(x1 - m_padding, y1 - m_padding),
v2s32(x2 + m_padding, y1) v2s32(x2 + m_padding, y1)
), NULL); ), NULL);
driver->draw2DRectangle(c_outside, driver->draw2DRectangle(c_outside,
core::rect<s32>( core::rect<s32>(
v2s32(x1 - m_padding, y2), v2s32(x1 - m_padding, y2),
v2s32(x2 + m_padding, y2 + m_padding) v2s32(x2 + m_padding, y2 + m_padding)
), NULL); ), NULL);
driver->draw2DRectangle(c_outside, driver->draw2DRectangle(c_outside,
core::rect<s32>( core::rect<s32>(
v2s32(x1 - m_padding, y1), v2s32(x1 - m_padding, y1),
v2s32(x1, y2) v2s32(x1, y2)
), NULL); ), NULL);
driver->draw2DRectangle(c_outside, driver->draw2DRectangle(c_outside,
core::rect<s32>( core::rect<s32>(
v2s32(x2, y1), v2s32(x2, y1),
v2s32(x2 + m_padding, y2) v2s32(x2 + m_padding, y2)
), NULL); ), NULL);
/*// Light inside borders /*// Light inside borders
driver->draw2DRectangle(c_inside, driver->draw2DRectangle(c_inside,
core::rect<s32>( core::rect<s32>(
v2s32(x1 - padding/2, y1 - padding/2), v2s32(x1 - padding/2, y1 - padding/2),
v2s32(x2 + padding/2, y1) v2s32(x2 + padding/2, y1)
), NULL); ), NULL);
driver->draw2DRectangle(c_inside, driver->draw2DRectangle(c_inside,
core::rect<s32>( core::rect<s32>(
v2s32(x1 - padding/2, y2), v2s32(x1 - padding/2, y2),
v2s32(x2 + padding/2, y2 + padding/2) v2s32(x2 + padding/2, y2 + padding/2)
), NULL); ), NULL);
driver->draw2DRectangle(c_inside, driver->draw2DRectangle(c_inside,
core::rect<s32>( core::rect<s32>(
v2s32(x1 - padding/2, y1), v2s32(x1 - padding/2, y1),
v2s32(x1, y2) v2s32(x1, y2)
), NULL); ), NULL);
driver->draw2DRectangle(c_inside, driver->draw2DRectangle(c_inside,
core::rect<s32>( core::rect<s32>(
v2s32(x2, y1), v2s32(x2, y1),
v2s32(x2 + padding/2, y2) v2s32(x2 + padding/2, y2)
), NULL); ), 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 //NOTE: selectitem = 0 -> no selected; selectitem 1-based
void Hud::drawItems(v2s32 upperleftpos, v2s32 screen_offset, s32 itemcount, void Hud::drawItems(v2s32 upperleftpos, v2s32 screen_offset, s32 itemcount,
s32 inv_offset, InventoryList *mainlist, u16 selectitem, u16 direction) s32 inv_offset, InventoryList *mainlist, u16 selectitem, u16 direction)