From d6fcce918ad24db69a12d5ffe785a933a5ec7654 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Mon, 9 Dec 2024 03:30:59 +0000 Subject: [PATCH] button_guide: fix luminance for low quality font --- UnleashedRecomp/ui/button_guide.cpp | 21 ++++++++++---------- UnleashedRecomp/ui/options_menu_thumbnails.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/UnleashedRecomp/ui/button_guide.cpp b/UnleashedRecomp/ui/button_guide.cpp index 95a5fc2..f415f9c 100644 --- a/UnleashedRecomp/ui/button_guide.cpp +++ b/UnleashedRecomp/ui/button_guide.cpp @@ -178,20 +178,21 @@ static void DrawGuide(float* offset, ImVec2 regionMin, ImVec2 regionMax, EButton auto btnIcon = GetButtonIcon(_icon); drawList->AddImage(std::get<1>(btnIcon), iconMin, iconMax, GET_UV_COORDS(std::get<0>(btnIcon))); + auto font = GetFont(fontQuality); + auto textMarginX = alignment == EButtonAlignment::Left ? regionMin.x + *offset + dualIconMarginX : regionMax.x - *offset - dualIconMarginX * 2; - DrawTextWithOutline - ( - GetFont(fontQuality), - fontSize, - { /* X */ textMarginX, /* Y */ regionMin.y + Scale(8) }, - IM_COL32(255, 255, 255, 255), - text, - 2, - IM_COL32(0, 0, 0, 255) - ); + auto textMarginY = regionMin.y + Scale(8); + + ImVec2 textPosition = { textMarginX, textMarginY }; + + DrawTextWithOutline(font, fontSize, textPosition, IM_COL32_WHITE, text, 2, IM_COL32_BLACK); + + // Add extra luminance to low quality text. + if (fontQuality == EFontQuality::Low) + drawList->AddText(font, fontSize, textPosition, IM_COL32(255, 255, 255, 127), text); if (icon == EButtonIcon::LBRB || icon == EButtonIcon::LTRT) { diff --git a/UnleashedRecomp/ui/options_menu_thumbnails.h b/UnleashedRecomp/ui/options_menu_thumbnails.h index 9646040..26266ed 100644 --- a/UnleashedRecomp/ui/options_menu_thumbnails.h +++ b/UnleashedRecomp/ui/options_menu_thumbnails.h @@ -36,7 +36,7 @@ #include #include -static std::unordered_map> g_thumbnails; +inline static std::unordered_map> g_thumbnails; static void LoadThumbnails() {