From e743d847cdc72226fd9c21a62f74c3929a1a0ff3 Mon Sep 17 00:00:00 2001 From: Francisco Demartino Date: Tue, 22 Feb 2022 12:23:38 -0300 Subject: [PATCH] GUI: unhardcode about line count --- src/gui/gui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2cb3ecfe..3f5faf54 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1486,7 +1486,7 @@ void FurnaceGUI::drawVolMeter() { ImGui::End(); } -const char* aboutLine[93]={ +const char* aboutLine[]={ "tildearrow", "is proud to present", "", @@ -1582,6 +1582,8 @@ const char* aboutLine[93]={ "thanks to all contributors/bug reporters!" }; +const size_t aboutCount = sizeof(aboutLine) / sizeof(aboutLine[0]); + void FurnaceGUI::drawAbout() { // do stuff if (ImGui::Begin("About Furnace",NULL,ImGuiWindowFlags_Modal|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoTitleBar)) { @@ -1631,7 +1633,7 @@ void FurnaceGUI::drawAbout() { } } - for (int i=0; i<93; i++) { + for (size_t i=0; iscrH*dpiScale) continue; @@ -1661,7 +1663,7 @@ void FurnaceGUI::drawAbout() { while (aboutHue>1) aboutHue--; while (aboutSin>=2400) aboutSin-=2400; - if (aboutScroll>(42*93+scrH)) aboutScroll=-20; + if (aboutScroll>(42*aboutCount+scrH)) aboutScroll=-20; } if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_ABOUT; ImGui::End();