mirror of
https://github.com/minetest/minetest.git
synced 2024-12-02 12:33:45 +01:00
Inventory move-to-slot hilighting
This commit is contained in:
parent
ebc7a36a83
commit
4196b0d341
@ -266,8 +266,16 @@ void GUIInventoryMenu::drawList(const ListDrawSpec &s, ITextureSource *tsrc)
|
|||||||
&AbsoluteClippingRect);
|
&AbsoluteClippingRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rect.isPointInside(m_pointer) && m_selected_item)
|
||||||
|
{
|
||||||
|
video::SColor bgcolor(255,192,192,192);
|
||||||
|
driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
video::SColor bgcolor(255,128,128,128);
|
video::SColor bgcolor(255,128,128,128);
|
||||||
driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
|
driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
|
||||||
|
}
|
||||||
|
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
@ -320,7 +328,9 @@ bool GUIInventoryMenu::OnEvent(const SEvent& event)
|
|||||||
{
|
{
|
||||||
char amount = -1;
|
char amount = -1;
|
||||||
|
|
||||||
if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
if(event.MouseInput.Event==EMIE_MOUSE_MOVED)
|
||||||
|
m_pointer = v2s32(event.MouseInput.X, event.MouseInput.Y);
|
||||||
|
else if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
||||||
amount = 0;
|
amount = 0;
|
||||||
else if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN)
|
else if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN)
|
||||||
amount = 1;
|
amount = 1;
|
||||||
|
@ -159,6 +159,7 @@ protected:
|
|||||||
core::array<ListDrawSpec> m_draw_spec;
|
core::array<ListDrawSpec> m_draw_spec;
|
||||||
|
|
||||||
ItemSpec *m_selected_item;
|
ItemSpec *m_selected_item;
|
||||||
|
v2s32 m_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user