From 6969dfcdd1b3f26cefdfd70c6137e013cdecb0c1 Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Wed, 2 Apr 2025 18:33:39 -0700 Subject: [PATCH] overlay: migrate configurator UI from ImGui Columns to Tables (#282) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Link to GitHub Issue, if one exists n/a ## Description of change `ImGui::Columns` is a deprecated component with many issues. Migrate Buttons/Analog/Overlay/Lights/Options... tabs to the new table API. Clean up some UI elements around it to reduce clutter. Note: there are still other usages of Columns API (MIDI debug output, ACIO viewer, window manager) but no one hardly ever sees those. Eventually they will need to be migrated if ImGui ever drops support for them. ## Compiling 👍 ## Testing Testing all games in spicecfg and overlay. --- src/spice2x/overlay/windows/config.cpp | 3660 ++++++++++++------------ 1 file changed, 1863 insertions(+), 1797 deletions(-) diff --git a/src/spice2x/overlay/windows/config.cpp b/src/spice2x/overlay/windows/config.cpp index f0656db..5db42b7 100644 --- a/src/spice2x/overlay/windows/config.cpp +++ b/src/spice2x/overlay/windows/config.cpp @@ -36,6 +36,8 @@ namespace overlay::windows { + // same width as dummy marker + const float INDENT = 22.f; const auto PROJECT_URL = "https://spice2x.github.io"; Config::Config(overlay::SpiceOverlay *overlay) : Window(overlay) { @@ -248,10 +250,8 @@ namespace overlay::windows { // help text for binding buttons, if the game has one const auto help_text = games::get_buttons_help(this->games_selected_name); if (!help_text.empty()) { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 8); ImGui::TextColored(ImVec4(1.f, 0.7f, 0, 1), "Button Layout"); ImGui::Spacing(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 8); ImGui::TextWrapped("%s", help_text.c_str()); ImGui::TextUnformatted(""); } @@ -262,15 +262,15 @@ namespace overlay::windows { // keypad buttons ImGui::TextUnformatted(""); if (this->games_selected_name == "Beatmania IIDX") { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 8); + ImGui::Indent(INDENT); ImGui::TextColored( ImVec4(1, 0.5f, 0.5f, 1.f), "WARNING: Lightning Model (TDJ) I/O will ignore the keypad!"); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 8); ImGui::TextWrapped( "Use Toggle Sub Screen button to show the overlay and use your mouse, " "connect using SpiceCompanion app, or connect a touch screen to enter " "the PIN."); + ImGui::Unindent(INDENT); ImGui::TextUnformatted(""); } auto keypad_buttons = games::get_buttons_keypads(this->games_selected_name); @@ -563,213 +563,300 @@ namespace overlay::windows { } void Config::build_buttons(const std::string &name, std::vector