From 3eff02d19f90b793c8b0816518dcb08983dfe83a Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:59:57 +0300 Subject: [PATCH] Fix outline sizes. --- UnleashedRecomp/ui/achievement_menu.cpp | 8 ++++---- UnleashedRecomp/ui/achievement_overlay.cpp | 4 ++-- UnleashedRecomp/ui/button_guide.cpp | 2 +- UnleashedRecomp/ui/imgui_utils.h | 6 ++++-- UnleashedRecomp/ui/installer_wizard.cpp | 2 +- UnleashedRecomp/ui/options_menu.cpp | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/UnleashedRecomp/ui/achievement_menu.cpp b/UnleashedRecomp/ui/achievement_menu.cpp index 8fa1f50d..eeea6dc0 100644 --- a/UnleashedRecomp/ui/achievement_menu.cpp +++ b/UnleashedRecomp/ui/achievement_menu.cpp @@ -222,7 +222,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen isUnlocked ? IM_COL32(252, 243, 5, 255) : colLockedText, achievement.Name.c_str(), shadowOffset, - 0.4f, + 1.0f, colTextShadow ); @@ -261,7 +261,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen isUnlocked ? IM_COL32_WHITE : colLockedText, desc, shadowOffset, - 0.4f, + 1.0f, colTextShadow ); } @@ -356,7 +356,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen { /* X */ CENTRE_TEXT_HORZ(timestampMin, timestampMax, textSize), /* Y */ CENTRE_TEXT_VERT(timestampMin, timestampMax, textSize) }, IM_COL32(255, 255, 255, 255), buffer, - 2, + 4, IM_COL32(8, 8, 8, 255) ); @@ -530,7 +530,7 @@ static void DrawAchievementTotal(ImVec2 min, ImVec2 max) { /* X */ imageMin.x - textSize.x - Scale(6), /* Y */ CENTRE_TEXT_VERT(imageMin, imageMax, textSize) }, IM_COL32(255, 255, 255, 255 * alpha), str.c_str(), - 2, + 4, IM_COL32(0, 0, 0, 255 * alpha) ); } diff --git a/UnleashedRecomp/ui/achievement_overlay.cpp b/UnleashedRecomp/ui/achievement_overlay.cpp index bd2a3782..4303e66e 100644 --- a/UnleashedRecomp/ui/achievement_overlay.cpp +++ b/UnleashedRecomp/ui/achievement_overlay.cpp @@ -143,7 +143,7 @@ void AchievementOverlay::Draw() IM_COL32(252, 243, 5, 255), // colour strAchievementUnlocked, // text 2, // offset - 0.4f, // radius + 1.0f, // radius IM_COL32(0, 0, 0, 255) // shadowColour ); @@ -156,7 +156,7 @@ void AchievementOverlay::Draw() IM_COL32(255, 255, 255, 255), // colour strAchievementName, // text 2, // offset - 0.4f, // radius + 1.0f, // radius IM_COL32(0, 0, 0, 255) // shadowColour ); diff --git a/UnleashedRecomp/ui/button_guide.cpp b/UnleashedRecomp/ui/button_guide.cpp index 7cbb2c10..1bec66aa 100644 --- a/UnleashedRecomp/ui/button_guide.cpp +++ b/UnleashedRecomp/ui/button_guide.cpp @@ -188,7 +188,7 @@ static void DrawGuide(float* offset, ImVec2 regionMin, ImVec2 regionMax, EButton ImVec2 textPosition = { textMarginX, textMarginY }; - DrawTextWithOutline(font, fontSize, textPosition, IM_COL32_WHITE, text, 2, IM_COL32_BLACK); + DrawTextWithOutline(font, fontSize, textPosition, IM_COL32_WHITE, text, 4, IM_COL32_BLACK); // Add extra luminance to low quality text. if (fontQuality == EFontQuality::Low) diff --git a/UnleashedRecomp/ui/imgui_utils.h b/UnleashedRecomp/ui/imgui_utils.h index cdb458c0..73e28d4c 100644 --- a/UnleashedRecomp/ui/imgui_utils.h +++ b/UnleashedRecomp/ui/imgui_utils.h @@ -207,13 +207,15 @@ static void DrawTextWithOutline(const ImFont* font, float fontSize, const ImVec2 SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE); } -static void DrawTextWithShadow(const ImFont* font, float fontSize, const ImVec2& pos, ImU32 colour, const char* text, float offset = 2.0f, float radius = 0.4f, ImU32 shadowColour = IM_COL32(0, 0, 0, 255)) +static void DrawTextWithShadow(const ImFont* font, float fontSize, const ImVec2& pos, ImU32 colour, const char* text, float offset = 2.0f, float radius = 1.0f, ImU32 shadowColour = IM_COL32(0, 0, 0, 255)) { auto drawList = ImGui::GetForegroundDrawList(); offset = Scale(offset); - DrawTextWithOutline(font, fontSize, { pos.x + offset, pos.y + offset }, shadowColour, text, radius, shadowColour); + SetOutline(radius); + drawList->AddText(font, fontSize, { pos.x + offset, pos.y + offset }, shadowColour, text); + ResetOutline(); drawList->AddText(font, fontSize, pos, colour, text, nullptr); } diff --git a/UnleashedRecomp/ui/installer_wizard.cpp b/UnleashedRecomp/ui/installer_wizard.cpp index 8eb3474c..5e4e85e5 100644 --- a/UnleashedRecomp/ui/installer_wizard.cpp +++ b/UnleashedRecomp/ui/installer_wizard.cpp @@ -768,7 +768,7 @@ static void DrawButton(ImVec2 min, ImVec2 max, const char *buttonText, bool sour min, IM_COL32(255, 255, 255, 255 * alpha), buttonText, - 2, + 4, IM_COL32(baser, baseg, 0, 255 * alpha) ); diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index f31b88aa..9cd1f05d 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -404,7 +404,7 @@ static bool DrawCategories() min, IM_COL32_WHITE, GetCategory(i).c_str(), - 3, + 4, IM_COL32_BLACK, IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL ); @@ -771,7 +771,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf min, IM_COL32(255, 255, 255, 255 * alpha), valueText.data(), - 2, + 4, IM_COL32(0, 0, 0, 255 * alpha) );