achievement_menu: fix locked shadow and marquee width

This commit is contained in:
Hyper 2024-12-11 23:03:01 +00:00
parent 4f26d0b263
commit 05ec19874e
2 changed files with 10 additions and 8 deletions

View file

@ -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
);
}

View file

@ -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;