#include #include #include #include bool SettingsWindow::render() { const ImVec2 center = ImGui::GetMainViewport()->GetCenter(); ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); if(!ImGui::BeginPopupModal("Settings", &isOpen, ImGuiWindowFlags_AlwaysAutoResize)) return false; if(!ImGui::BeginTabBar("SettingsTabBar")) return false; for (auto& [name, tab] : tabs) { if (ImGui::BeginTabItem(name.c_str())) { tab->render(); if (tab->modified && !applyEnabled) applyEnabled = true; ImGui::EndTabItem(); } } ImGui::EndTabBar(); ImGui::BeginDisabled(!applyEnabled); if(ImGui::Button("Apply")) { applyEnabled = false; Options::GetInstance().Apply(); for (const auto &tab : tabs | std::views::values) { tab->modified = false; } } ImGui::EndDisabled(); ImGui::SameLine(); if(ImGui::Button("Cancel")) { isOpen = false; ImGui::CloseCurrentPopup(); } ImGui::EndPopup(); return true; }