achievement_menu: change trophy colour by achievement count

This commit is contained in:
Hyper 2024-12-08 23:54:56 +00:00
parent e19e18b14d
commit b6de286057
2 changed files with 26 additions and 3 deletions

View file

@ -373,9 +373,32 @@ static void DrawAchievementTotal(ImVec2 min, ImVec2 max)
auto uv0 = ImVec2(columnIndex * spriteSize / textureWidth, rowIndex * spriteSize / textureHeight);
auto uv1 = ImVec2((columnIndex + 1) * spriteSize / textureWidth, (rowIndex + 1) * spriteSize / textureHeight);
drawList->AddImage(g_upTrophyIcon.get(), imageMin, imageMax, uv0, uv1, IM_COL32(255, 255, 255, 255 * alpha));
auto records = AchievementData::GetTotalRecords();
auto colour = IM_COL32(255, 255, 255, 255 * alpha);
auto str = std::format("{} / {}", AchievementData::GetTotalRecords(), ACH_RECORDS);
if (records <= 24)
{
// Bronze
colour = IM_COL32(198, 105, 15, 255 * alpha);
}
else if (records > 24 && records <= 49)
{
// Silver
colour = IM_COL32(220, 220, 220, 255 * alpha);
}
else if (records > 49 && records <= 50)
{
// Gold
colour = IM_COL32(255, 195, 56, 255 * alpha);
}
drawList->AddImage(g_upTrophyIcon.get(), imageMin, imageMax, uv0, uv1, colour);
// Add extra luminance to the trophy for bronze and gold.
if (records <= 24 || records <= 50)
drawList->AddImage(g_upTrophyIcon.get(), imageMin, imageMax, uv0, uv1, IM_COL32(255, 255, 255, 12));
auto str = std::format("{} / {}", records, ACH_RECORDS);
auto fontSize = Scale(20);
auto textSize = g_fntNewRodinDB->CalcTextSizeA(fontSize, FLT_MAX, 0, str.c_str());

@ -1 +1 @@
Subproject commit 3081bfaec87550e3a085f1ac4048c3b637b5481d
Subproject commit fd3b4f3a2fbe6e9f1b95baf535ad3dd8da3821b1