enum EInterfaceTabs {
eTabWeapon = 0,
eTabPlayer,
eTabVisuals,
eTabAiming,
eTabMisc,
eTabDebug,
eTabConsole,
eTabConfig,
eTabSettings,
eTabsCount
};
bool bTabs[EInterfaceTabs::eTabsCount] = { true };
bool inBox(float x, float y, float w, float h) {
return ImGui::GetMousePos().x >= x && ImGui::GetMousePos().x <= x + w && ImGui::GetMousePos().y >= y && ImGui::GetMousePos().y <= y + h;
}
void tabButton(ImVec2 position, ImVec2 size, std::string name, bool& var, ImColor in = ImColor(25, 25, 25), ImColor out = ImColor(15, 15, 15)) {
ImColor color;
if (this->inBox(position.x, position.y, size.x, size.y)) {
if (GetAsyncKeyState(0x1) & 0x1) {
for (int i = 0; i != CTabManager::EInterfaceTabs::eTabsCount; i++) {
this->m_pTM->bTabs[i] = 0;
}
var = !var;
}
}
this->inBox(position.x, position.y, size.x, size.y) ?
color = in :
color = out;
if (var) color = ImColor(35, 35, 35);
ImGui::GetForegroundDrawList()->AddRectFilled(CALC(position.x, position.y, size.x, size.y), color);
ImGui::GetForegroundDrawList()->AddText(ImVec2((position.x + (size.x / 2)) - (ImGui::CalcTextSize(name.c_str()).x / 2),
(position.y + (size.y / 2)) - (ImGui::CalcTextSize(name.c_str()).y / 2)), ImColor(255, 255, 255), name.c_str());
}
this->m_pDM->tabButton(ImVec2(200.f, 0.f), ImVec2(80.f, 35.f), xorstr(u8"Weapon"), this->m_pTM->bTabs[CTabManager::eTabWeapon]);
this->m_pDM->tabButton(ImVec2(280.f, 0.f), ImVec2(80.f, 35.f), xorstr(u8"Player"), this->m_pTM->bTabs[CTabManager::eTabPlayer]);
this->m_pDM->tabButton(ImVec2(360.f, 0.f), ImVec2(80.f, 35.f), xorstr(u8"Visuals"), this->m_pTM->bTabs[CTabManager::eTabVisuals]);