Skip to content

Commit 9f0bbcc

Browse files
committed
Achievements: Fix progress bar text alignment
1 parent 29f19d0 commit 9f0bbcc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/core/achievements.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,7 +2694,8 @@ void Achievements::DrawAchievementsWindow()
26942694
ImGui::GetColorU32(UIStyle.SecondaryColor));
26952695

26962696
text.format("{}%", static_cast<int>(std::round(fraction * 100.0f)));
2697-
text_size = ImGui::CalcTextSize(text.c_str(), text.end_ptr());
2697+
text_size =
2698+
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, text.c_str(), text.end_ptr());
26982699
const ImVec2 text_pos(
26992700
progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
27002701
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)
29182919
ImGui::GetColorU32(ImGuiFullscreen::UIStyle.SecondaryColor));
29192920

29202921
const ImVec2 text_size =
2921-
ImGui::CalcTextSize(measured_progress.data(), measured_progress.data() + measured_progress.size());
2922+
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, measured_progress.data(),
2923+
measured_progress.data() + measured_progress.size());
29222924
const ImVec2 text_pos(progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
29232925
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f));
29242926
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos,

0 commit comments

Comments
 (0)