Simple display of measured progress on achievements.

This commit is contained in:
Henrik Rydgård 2023-07-04 16:22:35 +02:00
parent 8b8f8c7a3c
commit 8966998868

View file

@ -305,8 +305,11 @@ void MeasureAchievement(const UIContext &dc, const rc_client_achievement_t *achi
void MeasureGameAchievementSummary(const UIContext &dc, float *w, float *h) {
std::string description = Achievements::GetGameAchievementSummary();
float tw, th;
dc.MeasureText(dc.theme->uiFont, 1.0f, 1.0f, "Wg", &tw, &th);
dc.MeasureText(dc.theme->uiFont, 0.66f, 0.66f, description.c_str(), w, h);
*h += 32.0f;
*h += 12.0f + th;
*w += 8.0f;
}
@ -377,6 +380,11 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement
dc.SetFontScale(0.66f, 0.66f);
dc.DrawTextRect(achievement->description, bounds.Inset(iconSpace + 12.0f, 39.0f, padding, padding), fgColor, ALIGN_TOPLEFT);
if (style == AchievementRenderStyle::LISTED && strlen(achievement->measured_progress) > 0) {
dc.SetFontScale(1.0f, 1.0f);
dc.DrawTextRect(achievement->measured_progress, bounds.Inset(iconSpace + 12.0f, padding, padding + 100.0f, padding), fgColor, ALIGN_VCENTER | ALIGN_RIGHT);
}
// TODO: Draw measured_progress / measured_percent in a cute way
snprintf(temp, sizeof(temp), "%d", achievement->points);