From 05ec19874e1dc18ff360b02d0bd25f7565fd9336 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:03:01 +0000 Subject: [PATCH] achievement_menu: fix locked shadow and marquee width --- UnleashedRecomp/ui/achievement_menu.cpp | 16 +++++++++------- UnleashedRecomp/ui/imgui_utils.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/UnleashedRecomp/ui/achievement_menu.cpp b/UnleashedRecomp/ui/achievement_menu.cpp index eeea6dc..f591ff9 100644 --- a/UnleashedRecomp/ui/achievement_menu.cpp +++ b/UnleashedRecomp/ui/achievement_menu.cpp @@ -205,13 +205,14 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen drawList->PushClipRect(min, max, true); - auto colLockedText = IM_COL32(60, 60, 60, 29); + auto colLockedText = IM_COL32(80, 80, 80, 127); auto colTextShadow = isUnlocked ? IM_COL32(0, 0, 0, 255) - : IM_COL32(60, 60, 60, 28); + : IM_COL32(20, 20, 20, 127); auto shadowOffset = isUnlocked ? 2 : 1; + auto shadowRadius = isUnlocked ? 1 : 0.5f; // Draw achievement name. DrawTextWithShadow @@ -222,13 +223,14 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen isUnlocked ? IM_COL32(252, 243, 5, 255) : colLockedText, achievement.Name.c_str(), shadowOffset, - 1.0f, + shadowRadius, colTextShadow ); ImVec2 marqueeMin = { textMarqueeX, min.y }; + ImVec2 marqueeMax = { max.x - Scale(10) /* timestamp margin X */, max.y }; - SetMarqueeFade(marqueeMin, max, Scale(32)); + SetMarqueeFade(marqueeMin, marqueeMax, Scale(32)); if (isSelected && textX + textSize.x >= max.x - Scale(10)) { @@ -239,14 +241,14 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen fontSize, { textX, min.y + descTextY }, marqueeMin, - max, + marqueeMax, isUnlocked ? IM_COL32_WHITE : colLockedText, desc, g_rowSelectionTime, 0.9, Scale(250), shadowOffset, - 0.4f, + shadowRadius, colTextShadow ); } @@ -261,7 +263,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen isUnlocked ? IM_COL32_WHITE : colLockedText, desc, shadowOffset, - 1.0f, + shadowRadius, colTextShadow ); } diff --git a/UnleashedRecomp/ui/imgui_utils.h b/UnleashedRecomp/ui/imgui_utils.h index 73e28d4..624ff16 100644 --- a/UnleashedRecomp/ui/imgui_utils.h +++ b/UnleashedRecomp/ui/imgui_utils.h @@ -337,7 +337,7 @@ static void DrawCentredParagraph(const ImFont* font, float fontSize, const ImVec } } -static void DrawTextWithMarqueeShadow(const ImFont* font, float fontSize, const ImVec2& pos, const ImVec2& min, const ImVec2& max, ImU32 colour, const char* text, double time, double delay, double speed, float offset = 2.0f, float radius = 0.4f, ImU32 shadowColour = IM_COL32(0, 0, 0, 255)) +static void DrawTextWithMarqueeShadow(const ImFont* font, float fontSize, const ImVec2& pos, const ImVec2& min, const ImVec2& max, ImU32 colour, const char* text, double time, double delay, double speed, float offset = 2.0f, float radius = 1.0f, ImU32 shadowColour = IM_COL32(0, 0, 0, 255)) { auto drawList = ImGui::GetForegroundDrawList(); auto rectWidth = max.x - min.x;