Fix outline sizes.

This commit is contained in:
Skyth 2024-12-11 22:59:57 +03:00
parent 5fd668ed55
commit 3eff02d19f
6 changed files with 14 additions and 12 deletions

View file

@ -222,7 +222,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen
isUnlocked ? IM_COL32(252, 243, 5, 255) : colLockedText, isUnlocked ? IM_COL32(252, 243, 5, 255) : colLockedText,
achievement.Name.c_str(), achievement.Name.c_str(),
shadowOffset, shadowOffset,
0.4f, 1.0f,
colTextShadow colTextShadow
); );
@ -261,7 +261,7 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen
isUnlocked ? IM_COL32_WHITE : colLockedText, isUnlocked ? IM_COL32_WHITE : colLockedText,
desc, desc,
shadowOffset, shadowOffset,
0.4f, 1.0f,
colTextShadow 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) }, { /* X */ CENTRE_TEXT_HORZ(timestampMin, timestampMax, textSize), /* Y */ CENTRE_TEXT_VERT(timestampMin, timestampMax, textSize) },
IM_COL32(255, 255, 255, 255), IM_COL32(255, 255, 255, 255),
buffer, buffer,
2, 4,
IM_COL32(8, 8, 8, 255) 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) }, { /* X */ imageMin.x - textSize.x - Scale(6), /* Y */ CENTRE_TEXT_VERT(imageMin, imageMax, textSize) },
IM_COL32(255, 255, 255, 255 * alpha), IM_COL32(255, 255, 255, 255 * alpha),
str.c_str(), str.c_str(),
2, 4,
IM_COL32(0, 0, 0, 255 * alpha) IM_COL32(0, 0, 0, 255 * alpha)
); );
} }

View file

@ -143,7 +143,7 @@ void AchievementOverlay::Draw()
IM_COL32(252, 243, 5, 255), // colour IM_COL32(252, 243, 5, 255), // colour
strAchievementUnlocked, // text strAchievementUnlocked, // text
2, // offset 2, // offset
0.4f, // radius 1.0f, // radius
IM_COL32(0, 0, 0, 255) // shadowColour IM_COL32(0, 0, 0, 255) // shadowColour
); );
@ -156,7 +156,7 @@ void AchievementOverlay::Draw()
IM_COL32(255, 255, 255, 255), // colour IM_COL32(255, 255, 255, 255), // colour
strAchievementName, // text strAchievementName, // text
2, // offset 2, // offset
0.4f, // radius 1.0f, // radius
IM_COL32(0, 0, 0, 255) // shadowColour IM_COL32(0, 0, 0, 255) // shadowColour
); );

View file

@ -188,7 +188,7 @@ static void DrawGuide(float* offset, ImVec2 regionMin, ImVec2 regionMax, EButton
ImVec2 textPosition = { textMarginX, textMarginY }; 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. // Add extra luminance to low quality text.
if (fontQuality == EFontQuality::Low) if (fontQuality == EFontQuality::Low)

View file

@ -207,13 +207,15 @@ static void DrawTextWithOutline(const ImFont* font, float fontSize, const ImVec2
SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE); 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(); auto drawList = ImGui::GetForegroundDrawList();
offset = Scale(offset); 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); drawList->AddText(font, fontSize, pos, colour, text, nullptr);
} }

View file

@ -768,7 +768,7 @@ static void DrawButton(ImVec2 min, ImVec2 max, const char *buttonText, bool sour
min, min,
IM_COL32(255, 255, 255, 255 * alpha), IM_COL32(255, 255, 255, 255 * alpha),
buttonText, buttonText,
2, 4,
IM_COL32(baser, baseg, 0, 255 * alpha) IM_COL32(baser, baseg, 0, 255 * alpha)
); );

View file

@ -404,7 +404,7 @@ static bool DrawCategories()
min, min,
IM_COL32_WHITE, IM_COL32_WHITE,
GetCategory(i).c_str(), GetCategory(i).c_str(),
3, 4,
IM_COL32_BLACK, IM_COL32_BLACK,
IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL
); );
@ -771,7 +771,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
min, min,
IM_COL32(255, 255, 255, 255 * alpha), IM_COL32(255, 255, 255, 255 * alpha),
valueText.data(), valueText.data(),
2, 4,
IM_COL32(0, 0, 0, 255 * alpha) IM_COL32(0, 0, 0, 255 * alpha)
); );