From d0790c62bad223bea46d012983d5cb13d33550d9 Mon Sep 17 00:00:00 2001 From: linuxversion <1660477+SomeCrazyGuy@users.noreply.github.com> Date: Wed, 15 May 2024 21:47:44 -0400 Subject: [PATCH] Tweak font settings and help menu layout --- src/gui.cpp | 18 ++---------------- src/main.cpp | 2 +- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 19b4f14..4d6ec0c 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -14,10 +14,8 @@ static const struct simple_draw_t* const SimpleDraw{GetSimpleDrawAPI()}; extern void draw_gui() { static ImGuiTabItemFlags ConsoleDefaultFlags = ImGuiTabItemFlags_SetSelected; - static int FontScalePercent = 100; static bool initpos = false; - if (!initpos) { initpos = true; @@ -28,22 +26,10 @@ extern void draw_gui() { //put the window in the middle of the screen at 50% game width and height ImGui::SetNextWindowPos(ImVec2{ width / 2, height / 2 }); ImGui::SetNextWindowSize(ImVec2{ width, height }); - - //scale up the font based on 1920x1080 = 100% - float hf = size.y / 1080.f; - if (hf > 1.f) { - FontScalePercent = (int)(hf * FontScalePercent); - } - } - - //force font size based on fontscaleoverride parameter if set - if (GetSettings()->FontScaleOverride) { - FontScalePercent = GetSettings()->FontScaleOverride; } auto imgui_context = ImGui::GetCurrentContext(); ImGui::Begin(BetterAPIName " Mod Menu"); - ImGui::SetWindowFontScale(FontScalePercent / 100.f); ImGui::BeginTabBar("mod tabs"); size_t infos_count = 0; @@ -51,7 +37,7 @@ extern void draw_gui() { //todo: make the help text always visible with font size override? ImGui::SetWindowFontScale(1); - if (ImGui::TabItemButton("Help", ImGuiTabItemFlags_Trailing)) { + if (ImGui::TabItemButton("Help", ImGuiTabItemFlags_Leading)) { ImGui::OpenPopup("HelpLinks"); } if (ImGui::BeginPopup("HelpLinks")) { @@ -85,7 +71,7 @@ extern void draw_gui() { } ImGui::EndPopup(); } - ImGui::SetWindowFontScale(GetSettings()->FontScaleOverride / 100); + ImGui::SetWindowFontScale((float) GetSettings()->FontScaleOverride / 100.f); //TODO: the internal modmenu tab could be part of the internal plugin diff --git a/src/main.cpp b/src/main.cpp index 4754029..1dcb73d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -282,7 +282,7 @@ static void SetupModMenu() { auto s = GetSettingsMutable(); API.Config->Open(BetterAPIName); API.Config->BindInt(BIND_INT_DEFAULT(s->ConsoleHotkey)); - API.Config->BindInt(BIND_VALUE(s->FontScaleOverride), 50, 300, NULL); + API.Config->BindInt(BIND_INT_DEFAULT(s->FontScaleOverride)); API.Config->BindInt(BIND_INT_DEFAULT(s->HotkeyModifier)); API.Config->Close(); DEBUG("Settings Loaded");