Guest User

minetest - menu mouse-over hilighting

a guest
Nov 30th, 2011
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -rupN minetest_orig/src/guiInventoryMenu.cpp minetest_modified/src/guiInventoryMenu.cpp
  2. --- minetest_orig/src/guiInventoryMenu.cpp 2011-11-30 10:54:54.000000000 +0100
  3. +++ minetest_modified/src/guiInventoryMenu.cpp 2011-11-30 20:38:55.087960470 +0100
  4. @@ -266,8 +266,14 @@ void GUIInventoryMenu::drawList(const Li
  5. &AbsoluteClippingRect);
  6. }
  7.  
  8. - video::SColor bgcolor(255,128,128,128);
  9. - driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
  10. + if(rect.isPointInside(m_pointer))
  11. + {
  12. + video::SColor bgcolor(255,255,128,128);
  13. + driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
  14. + } else {
  15. + video::SColor bgcolor(255,128,128,128);
  16. + driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
  17. + }
  18.  
  19. if(item)
  20. {
  21. @@ -319,8 +325,10 @@ bool GUIInventoryMenu::OnEvent(const SEv
  22. if(event.EventType==EET_MOUSE_INPUT_EVENT)
  23. {
  24. char amount = -1;
  25. -
  26. - if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
  27. +
  28. + if(event.MouseInput.Event==EMIE_MOUSE_MOVED)
  29. + m_pointer = v2s32(event.MouseInput.X, event.MouseInput.Y);
  30. + else if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
  31. amount = 0;
  32. else if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN)
  33. amount = 1;
  34. diff -rupN minetest_orig/src/guiInventoryMenu.h minetest_modified/src/guiInventoryMenu.h
  35. --- minetest_orig/src/guiInventoryMenu.h 2011-11-30 10:54:54.000000000 +0100
  36. +++ minetest_modified/src/guiInventoryMenu.h 2011-11-30 20:36:39.088186751 +0100
  37. @@ -159,6 +159,7 @@ protected:
  38. core::array<ListDrawSpec> m_draw_spec;
  39.  
  40. ItemSpec *m_selected_item;
  41. + v2s32 m_pointer;
  42. };
  43.  
  44. #endif
  45.  
RAW Paste Data