From ed40bce0cde506a3dd059652e0745f73e2698cf9 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Tue, 18 Jun 2024 20:33:58 +0200 Subject: [PATCH] ThemeTweak: older themes at the end of list --- src/hello_imgui/impl/imgui_theme.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hello_imgui/impl/imgui_theme.cpp b/src/hello_imgui/impl/imgui_theme.cpp index 47386005..d0ec0734 100644 --- a/src/hello_imgui/impl/imgui_theme.cpp +++ b/src/hello_imgui/impl/imgui_theme.cpp @@ -1024,9 +1024,11 @@ namespace ImGuiTheme ImVec2 listboxSize = ImVec2(0.f, ImGuiTheme_Count * (ImGui::GetFontSize() + ImGui::GetStyle().ItemInnerSpacing.y) ); if (ImGui::BeginListBox("Available_themes", listboxSize)) { - for (int i = 0; i < ImGuiTheme_Count; ++i) + int nbThemes = ImGuiTheme_Count; + // We start at 3 because we want to place the older themes at the end + for (int i = 3; i < nbThemes + 3; ++i) { - ImGuiTheme_ theme_i = (ImGuiTheme_)(i); + ImGuiTheme_ theme_i = (ImGuiTheme_)(i % nbThemes); const bool is_selected = (*theme == theme_i); if (ImGui::Selectable(ImGuiTheme_Name(theme_i), is_selected)) {