Skip to content

Commit 53acc32

Browse files
committedJun 19, 2017
hud.cpp: fix wrong indent in drawItem
1 parent 4dcc598 commit 53acc32

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed
 

‎src/hud.cpp

+70-70
Original file line numberDiff line numberDiff line change
@@ -120,79 +120,79 @@ void Hud::drawItem(const ItemStack &item, const core::rect<s32>& rect,
120120
bool selected)
121121
{
122122
if (selected) {
123-
/* draw hihlighting around selected item */
124-
if (use_hotbar_selected_image) {
125-
core::rect<s32> imgrect2 = rect;
126-
imgrect2.UpperLeftCorner.X -= (m_padding*2);
127-
imgrect2.UpperLeftCorner.Y -= (m_padding*2);
128-
imgrect2.LowerRightCorner.X += (m_padding*2);
129-
imgrect2.LowerRightCorner.Y += (m_padding*2);
130-
video::ITexture *texture = tsrc->getTexture(hotbar_selected_image);
131-
core::dimension2di imgsize(texture->getOriginalSize());
132-
draw2DImageFilterScaled(driver, texture, imgrect2,
133-
core::rect<s32>(core::position2d<s32>(0,0), imgsize),
134-
NULL, hbar_colors, true);
135-
} else {
136-
video::SColor c_outside(255,255,0,0);
137-
//video::SColor c_outside(255,0,0,0);
138-
//video::SColor c_inside(255,192,192,192);
139-
s32 x1 = rect.UpperLeftCorner.X;
140-
s32 y1 = rect.UpperLeftCorner.Y;
141-
s32 x2 = rect.LowerRightCorner.X;
142-
s32 y2 = rect.LowerRightCorner.Y;
143-
// Black base borders
144-
driver->draw2DRectangle(c_outside,
145-
core::rect<s32>(
146-
v2s32(x1 - m_padding, y1 - m_padding),
147-
v2s32(x2 + m_padding, y1)
148-
), NULL);
149-
driver->draw2DRectangle(c_outside,
150-
core::rect<s32>(
151-
v2s32(x1 - m_padding, y2),
152-
v2s32(x2 + m_padding, y2 + m_padding)
153-
), NULL);
154-
driver->draw2DRectangle(c_outside,
155-
core::rect<s32>(
156-
v2s32(x1 - m_padding, y1),
157-
v2s32(x1, y2)
158-
), NULL);
159-
driver->draw2DRectangle(c_outside,
160-
core::rect<s32>(
161-
v2s32(x2, y1),
162-
v2s32(x2 + m_padding, y2)
163-
), NULL);
164-
/*// Light inside borders
165-
driver->draw2DRectangle(c_inside,
166-
core::rect<s32>(
167-
v2s32(x1 - padding/2, y1 - padding/2),
168-
v2s32(x2 + padding/2, y1)
169-
), NULL);
170-
driver->draw2DRectangle(c_inside,
171-
core::rect<s32>(
172-
v2s32(x1 - padding/2, y2),
173-
v2s32(x2 + padding/2, y2 + padding/2)
174-
), NULL);
175-
driver->draw2DRectangle(c_inside,
176-
core::rect<s32>(
177-
v2s32(x1 - padding/2, y1),
178-
v2s32(x1, y2)
179-
), NULL);
180-
driver->draw2DRectangle(c_inside,
181-
core::rect<s32>(
182-
v2s32(x2, y1),
183-
v2s32(x2 + padding/2, y2)
184-
), NULL);
185-
*/
186-
}
123+
/* draw hihlighting around selected item */
124+
if (use_hotbar_selected_image) {
125+
core::rect<s32> imgrect2 = rect;
126+
imgrect2.UpperLeftCorner.X -= (m_padding*2);
127+
imgrect2.UpperLeftCorner.Y -= (m_padding*2);
128+
imgrect2.LowerRightCorner.X += (m_padding*2);
129+
imgrect2.LowerRightCorner.Y += (m_padding*2);
130+
video::ITexture *texture = tsrc->getTexture(hotbar_selected_image);
131+
core::dimension2di imgsize(texture->getOriginalSize());
132+
draw2DImageFilterScaled(driver, texture, imgrect2,
133+
core::rect<s32>(core::position2d<s32>(0,0), imgsize),
134+
NULL, hbar_colors, true);
135+
} else {
136+
video::SColor c_outside(255,255,0,0);
137+
//video::SColor c_outside(255,0,0,0);
138+
//video::SColor c_inside(255,192,192,192);
139+
s32 x1 = rect.UpperLeftCorner.X;
140+
s32 y1 = rect.UpperLeftCorner.Y;
141+
s32 x2 = rect.LowerRightCorner.X;
142+
s32 y2 = rect.LowerRightCorner.Y;
143+
// Black base borders
144+
driver->draw2DRectangle(c_outside,
145+
core::rect<s32>(
146+
v2s32(x1 - m_padding, y1 - m_padding),
147+
v2s32(x2 + m_padding, y1)
148+
), NULL);
149+
driver->draw2DRectangle(c_outside,
150+
core::rect<s32>(
151+
v2s32(x1 - m_padding, y2),
152+
v2s32(x2 + m_padding, y2 + m_padding)
153+
), NULL);
154+
driver->draw2DRectangle(c_outside,
155+
core::rect<s32>(
156+
v2s32(x1 - m_padding, y1),
157+
v2s32(x1, y2)
158+
), NULL);
159+
driver->draw2DRectangle(c_outside,
160+
core::rect<s32>(
161+
v2s32(x2, y1),
162+
v2s32(x2 + m_padding, y2)
163+
), NULL);
164+
/*// Light inside borders
165+
driver->draw2DRectangle(c_inside,
166+
core::rect<s32>(
167+
v2s32(x1 - padding/2, y1 - padding/2),
168+
v2s32(x2 + padding/2, y1)
169+
), NULL);
170+
driver->draw2DRectangle(c_inside,
171+
core::rect<s32>(
172+
v2s32(x1 - padding/2, y2),
173+
v2s32(x2 + padding/2, y2 + padding/2)
174+
), NULL);
175+
driver->draw2DRectangle(c_inside,
176+
core::rect<s32>(
177+
v2s32(x1 - padding/2, y1),
178+
v2s32(x1, y2)
179+
), NULL);
180+
driver->draw2DRectangle(c_inside,
181+
core::rect<s32>(
182+
v2s32(x2, y1),
183+
v2s32(x2 + padding/2, y2)
184+
), NULL);
185+
*/
187186
}
188-
189-
video::SColor bgcolor2(128, 0, 0, 0);
190-
if (!use_hotbar_image)
191-
driver->draw2DRectangle(bgcolor2, rect, NULL);
192-
drawItemStack(driver, g_fontengine->getFont(), item, rect, NULL,
193-
client, selected ? IT_ROT_SELECTED : IT_ROT_NONE);
194187
}
195188

189+
video::SColor bgcolor2(128, 0, 0, 0);
190+
if (!use_hotbar_image)
191+
driver->draw2DRectangle(bgcolor2, rect, NULL);
192+
drawItemStack(driver, g_fontengine->getFont(), item, rect, NULL,
193+
client, selected ? IT_ROT_SELECTED : IT_ROT_NONE);
194+
}
195+
196196
//NOTE: selectitem = 0 -> no selected; selectitem 1-based
197197
void Hud::drawItems(v2s32 upperleftpos, v2s32 screen_offset, s32 itemcount,
198198
s32 inv_offset, InventoryList *mainlist, u16 selectitem, u16 direction)

0 commit comments

Comments
 (0)
Please sign in to comment.