aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-01 11:25:55 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-01 11:25:55 +0200
commit4196b0d341ec9132490eca6f9a116b80042ee2b1 (patch)
treeba6c770b5b8520c0ae85e1175ea46deb1e7c861a
parentebc7a36a837bf85f3f3b8d96abbf352406c02286 (diff)
downloadminetest-4196b0d341ec9132490eca6f9a116b80042ee2b1.tar.gz
minetest-4196b0d341ec9132490eca6f9a116b80042ee2b1.tar.bz2
minetest-4196b0d341ec9132490eca6f9a116b80042ee2b1.zip
Inventory move-to-slot hilighting
-rw-r--r--src/guiInventoryMenu.cpp20
-rw-r--r--src/guiInventoryMenu.h1
2 files changed, 16 insertions, 5 deletions
diff --git a/src/guiInventoryMenu.cpp b/src/guiInventoryMenu.cpp
index 9b73af3e0..47393e800 100644
--- a/src/guiInventoryMenu.cpp
+++ b/src/guiInventoryMenu.cpp
@@ -265,9 +265,17 @@ void GUIInventoryMenu::drawList(const ListDrawSpec &s, ITextureSource *tsrc)
rect.LowerRightCorner + v2s32(1,1)*border),
&AbsoluteClippingRect);
}
-
- video::SColor bgcolor(255,128,128,128);
- driver->draw2DRectangle(bgcolor, rect, &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);
+ driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
+ }
if(item)
{
@@ -319,8 +327,10 @@ bool GUIInventoryMenu::OnEvent(const SEvent& event)
if(event.EventType==EET_MOUSE_INPUT_EVENT)
{
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;
else if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN)
amount = 1;
diff --git a/src/guiInventoryMenu.h b/src/guiInventoryMenu.h
index 55d18a851..c8fe0d068 100644
--- a/src/guiInventoryMenu.h
+++ b/src/guiInventoryMenu.h
@@ -159,6 +159,7 @@ protected:
core::array<ListDrawSpec> m_draw_spec;
ItemSpec *m_selected_item;
+ v2s32 m_pointer;
};
#endif