Achievements: Fix progress bar text alignment

This commit is contained in:
Stenzek 2025-03-08 12:06:52 +10:00
parent 29f19d0ab6
commit 9f0bbccd50
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -2694,7 +2694,8 @@ void Achievements::DrawAchievementsWindow()
ImGui::GetColorU32(UIStyle.SecondaryColor));
text.format("{}%", static_cast<int>(std::round(fraction * 100.0f)));
text_size = ImGui::CalcTextSize(text.c_str(), text.end_ptr());
text_size =
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, text.c_str(), text.end_ptr());
const ImVec2 text_pos(
progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f));
@ -2918,7 +2919,8 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
ImGui::GetColorU32(ImGuiFullscreen::UIStyle.SecondaryColor));
const ImVec2 text_size =
ImGui::CalcTextSize(measured_progress.data(), measured_progress.data() + measured_progress.size());
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, measured_progress.data(),
measured_progress.data() + measured_progress.size());
const ImVec2 text_pos(progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f));
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos,