Advertisement
Guest User

YoloSanta

a guest
Apr 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. add it before onrendergui() in client.cpp
  2.  
  3.  
  4. void DrawRectRainbow(int x, int y, int width, int height, float flSpeed, float &flRainbow)
  5. {
  6. ImDrawList* windowDrawList = ImGui::GetWindowDrawList();
  7.  
  8. Color colColor(0, 0, 0, 255);
  9.  
  10. flRainbow += flSpeed;
  11. if (flRainbow > 1.f) flRainbow = 0.f;
  12.  
  13. for (int i = 0; i < width; i++)
  14. {
  15. float hue = (1.f / (float)width) * i;
  16. hue -= flRainbow;
  17. if (hue < 0.f) hue += 1.f;
  18.  
  19. Color colRainbow = colColor.FromHSB(hue, 1.f, 1.f);
  20. windowDrawList->AddRectFilled(ImVec2(x + i, y), ImVec2(width, height), colRainbow.GetU32());
  21. }
  22. }
  23.  
  24.  
  25.  
  26. add that in the menu
  27.  
  28.  
  29.  
  30.  
  31. static float flRainbow;
  32. float flSpeed = 0.0003f;
  33. int curWidth = 1;
  34. ImVec2 curPos = ImGui::GetCursorPos();
  35. ImVec2 curWindowPos = ImGui::GetWindowPos();
  36. curPos.x += curWindowPos.x;
  37. curPos.y += curWindowPos.y;
  38. int size;
  39. int y;
  40. Interfaces::Engine()->GetScreenSize(y, size);
  41. DrawRectRainbow(curPos.x - 10, curPos.y - 5, ImGui::GetWindowSize().x + size, curPos.y + -4, flSpeed, flRainbow);
  42.  
  43.  
  44.  
  45.  
  46. =====================================================================================================
  47.  
  48. fix for GetU32().
  49.  
  50. add it in color.hpp
  51. after
  52.  
  53. static Color FromHSB(float hue, float saturation, float brightness)
  54.  
  55.  
  56. ImU32 GetU32()
  57. {
  58. return ((_color[3] & 0xff) << 24) + ((_color[2] & 0xff) << 16) + ((_color[1] & 0xff) << 8)
  59. + (_color[0] & 0xff);
  60. //return (ImU32)(((_color[3] & 0xff) << 24) + ((_color[0] & 0xff) << 16) + ((_color[1] & 0xff) << 8) + (_color[2] & 0xff));
  61. }
  62.  
  63.  
  64.  
  65. How it looks: https://imgur.com/a/qOeHd
  66. where to put second part of code:
  67. https://imgur.com/a/WaE7Y
  68.  
  69. HOW TO CHANGE THE SIZE OR THE BAR:
  70. DrawRectRainbow(curPos.x - 10, curPos.y - 5, ImGui::GetWindowSize().x + size, curPos.y + -4, flSpeed, flRainbow);
  71. -4 is he height change it to your likeing.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement