Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. size_t CurTabOpen = 0;
  2.  
  3. void AddTab(size_t Index, const char* Text)
  4. {
  5. static const size_t TabWidth = 85;
  6. static const size_t TabHeight = 18;
  7.  
  8. ImGui::PushID(Index);
  9. ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
  10.  
  11. if (Index == 1)
  12. ImGui::SameLine(Index * (TabWidth + 5));
  13. else if (Index > 1)
  14. ImGui::SameLine(Index * (TabWidth + 4 - Index));
  15.  
  16. if (CurTabOpen == Index)
  17. ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor(15, 15, 15)); // Color on tab open
  18. else
  19. ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor(30, 30, 30)); // Color on tab closed
  20.  
  21. ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor(40, 40, 40)); // Color on mouse hover in tab
  22. ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor(35, 35, 35)); // Color on click tab
  23.  
  24. if (ImGui::Button(Text, ImVec2(TabWidth, TabHeight))) // If tab clicked
  25. CurTabOpen = Index;
  26.  
  27. ImGui::PopStyleVar();
  28. ImGui::PopStyleColor(3);
  29. ImGui::PopID();
  30. }
  31.  
  32. Example:
  33. AddTab(0, "Aimbot");
  34. AddTab(1, "Triggerbot");
  35. AddTab(2, "Visual");
  36. AddTab(3, "Weapon");
  37. AddTab(4, "Player");
  38. AddTab(5, "Config");
  39.  
  40. switch (CurTabOpen)
  41. {
  42. case 0:
  43. // Aimbot tab draws here
  44. break;
  45. case 1:
  46. // Triggerbot tab draws here
  47. break;
  48. case 2:
  49. // Visual tab draws here
  50. break;
  51. case 3:
  52. // Weapon tab draws here
  53. break;
  54. case 4:
  55. // Player tab draws here
  56. break;
  57. case 5:
  58. // Config tab draws here
  59. break;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement