Guest User

Untitled

a guest
Jul 29th, 2020
16
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // [GUIButton::setFromStyles()] If button is hovered, scaleup it multiplying by SCALEUP_HOVERED_MOD
  2. infostream << "Checking for \'scaleup_hovered\' availability...\n";
  3. if (style.isNotDefault(StyleSpec::SCALEUP_HOVERED)) {
  4. infostream << "\'scaleup_hovered\' element is set!\n";
  5. infostream << "Current button size:\n";
  6. infostream << "UpperLeftCorner: (" << AbsoluteRect.UpperLeftCorner.X << ", " << AbsoluteRect.UpperLeftCorner.Y << ")\n";
  7. infostream << "LowerRightCorner: (" << AbsoluteRect.LowerRightCorner.X << ", " << AbsoluteRect.LowerRightCorner.Y << ")\n";
  8.  
  9. if (prev_rect_size.capacity() == 0)
  10. prev_rect_size.resize(2);
  11.  
  12. if (hovered) {
  13. infostream << "The element has been hovered!\n";
  14. infostream << typeid(prev_rect_size[1]).name() << "\n";
  15. infostream << typeid(AbsoluteRect.UpperLeftCorner).name() << "\n";
  16. prev_rect_size.at(0) = AbsoluteRect.UpperLeftCorner;
  17. infostream << "1\n";
  18. prev_rect_size.at(1) = AbsoluteRect.LowerRightCorner;
  19. infostream << "2\n";
  20.  
  21. AbsoluteRect.UpperLeftCorner.X *= SCALEUP_HOVERED_MOD;
  22. infostream << "3\n";
  23. AbsoluteRect.UpperLeftCorner.Y *= SCALEUP_HOVERED_MOD;
  24. AbsoluteRect.LowerRightCorner.X *= SCALEUP_HOVERED_MOD;
  25. AbsoluteRect.LowerRightCorner.Y *= SCALEUP_HOVERED_MOD;
  26.  
  27. updateAbsolutePosition();
  28. /*rect_size[1] = v2f(
  29. rect_size[1].X*SCALEUP_HOVERED_MOD,
  30. rect_size[1].Y*SCALEUP_HOVERED_MOD
  31. );
  32. rect_size[2] = v2f(
  33. rect_size[2].X*SCALEUP_HOVERED_MOD,
  34. rect_size[2].Y*SCALEUP_HOVERED_MOD
  35. );
  36. std::vector<v2f> rect_size = getAbsoluteRectSize();
  37. prev_rect_size = rect_size;
  38. setAbsoluteRectSize(
  39. rect_size[1].X*SCALEUP_HOVERED_MOD,
  40. rect_size[1].Y*SCALEUP_HOVERED_MOD,
  41. rect_size[2].X*SCALEUP_HOVERED_MOD,
  42. rect_size[2].Y*SCALEUP_HOVERED_MOD
  43. );*/
  44. infostream << "Current button size (after hovering):\n";
  45. infostream << "UpperLeftCorner: (" << AbsoluteRect.UpperLeftCorner.X << ", " << AbsoluteRect.UpperLeftCorner.Y << ")\n";
  46. infostream << "LowerRightCorner: (" << AbsoluteRect.LowerRightCorner.X << ", " << AbsoluteRect.LowerRightCorner.Y << ")\n";
  47. }
  48. else if (!hovered && !prev_rect_size.empty()) {
  49. infostream << "The element has been released!\n";
  50. // Get back the previous saved size for the button
  51.  
  52. AbsoluteRect.UpperLeftCorner.X = prev_rect_size.at(0).X;
  53. AbsoluteRect.UpperLeftCorner.Y = prev_rect_size.at(0).Y;
  54. AbsoluteRect.LowerRightCorner.X = prev_rect_size.at(1).X;
  55. AbsoluteRect.LowerRightCorner.Y = prev_rect_size.at(1).Y;
  56.  
  57. updateAbsolutePosition();
  58. prev_rect_size.clear();
  59. /*setAbsoluteRectSize(
  60. prev_rect_size[1].X,
  61. prev_rect_size[1].Y,
  62. prev_rect_size[2].X,
  63. prev_rect_size[2].Y
  64. );
  65.  
  66. prev_rect_size.clear();*/
  67.  
  68. infostream << "Current button size (after releasing):\n";
  69. infostream << "UpperLeftCorner: (" << AbsoluteRect.UpperLeftCorner.X << ", " << AbsoluteRect.UpperLeftCorner.Y << ")\n";
  70. infostream << "LowerRightCorner: (" << AbsoluteRect.LowerRightCorner.X << ", " << AbsoluteRect.LowerRightCorner.Y << ")\n";
  71. }
  72.  
  73. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×