Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- size_t CurTabOpen = 0;
- void AddTab(size_t Index, const char* Text)
- {
- static const size_t TabWidth = 85;
- static const size_t TabHeight = 18;
- ImGui::PushID(Index);
- ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
- if (Index == 1)
- ImGui::SameLine(Index * (TabWidth + 5));
- else if (Index > 1)
- ImGui::SameLine(Index * (TabWidth + 4 - Index));
- if (CurTabOpen == Index)
- ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor(15, 15, 15)); // Color on tab open
- else
- ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor(30, 30, 30)); // Color on tab closed
- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor(40, 40, 40)); // Color on mouse hover in tab
- ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor(35, 35, 35)); // Color on click tab
- if (ImGui::Button(Text, ImVec2(TabWidth, TabHeight))) // If tab clicked
- CurTabOpen = Index;
- ImGui::PopStyleVar();
- ImGui::PopStyleColor(3);
- ImGui::PopID();
- }
- Example:
- AddTab(0, "Aimbot");
- AddTab(1, "Triggerbot");
- AddTab(2, "Visual");
- AddTab(3, "Weapon");
- AddTab(4, "Player");
- AddTab(5, "Config");
- switch (CurTabOpen)
- {
- case 0:
- // Aimbot tab draws here
- break;
- case 1:
- // Triggerbot tab draws here
- break;
- case 2:
- // Visual tab draws here
- break;
- case 3:
- // Weapon tab draws here
- break;
- case 4:
- // Player tab draws here
- break;
- case 5:
- // Config tab draws here
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement