Inventory move-to-slot hilighting
authorPerttu Ahola <celeron55@gmail.com>
Thu, 1 Dec 2011 09:25:55 +0000 (11:25 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Thu, 1 Dec 2011 09:25:55 +0000 (11:25 +0200)
src/guiInventoryMenu.cpp
src/guiInventoryMenu.h

index 9b73af3e084e90c6e450ebab2aacdfc6702a9ac7..47393e8008e81f7cc0b60148760c378bd8f4af40 100644 (file)
@@ -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;
index 55d18a851055f2f7cdf8b963bd4475ba6a93d850..c8fe0d0681323ba030fd23144481a2e9b6dc32d6 100644 (file)
@@ -159,6 +159,7 @@ protected:
        core::array<ListDrawSpec> m_draw_spec;
 
        ItemSpec *m_selected_item;
+       v2s32 m_pointer;
 };
 
 #endif