Skip to content

Commit 4f00a7c

Browse files
committed
FullscreenUI: Add rounding to achievements progress bars
1 parent 3420af8 commit 4f00a7c

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/core/achievements.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,7 @@ void Achievements::DrawPauseMenuOverlays(float start_pos_y)
25732573
const float text_spacing = LayoutScale(2.0f);
25742574

25752575
const float progress_height = LayoutScale(20.0f);
2576+
const float progress_rounding = LayoutScale(5.0f);
25762577
const float badge_size = LayoutScale(40.0f);
25772578
const float badge_text_width = box_content_width - badge_size - text_spacing - text_spacing;
25782579

@@ -2649,10 +2650,11 @@ void Achievements::DrawPauseMenuOverlays(float start_pos_y)
26492650

26502651
const ImRect progress_bb(text_pos, text_pos + ImVec2(box_content_width, progress_height));
26512652
const u32 progress_color = ImGui::GetColorU32(DarkerColor(UIStyle.SecondaryColor));
2652-
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor));
2653+
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor),
2654+
progress_rounding);
26532655
dl->AddRectFilled(progress_bb.Min,
26542656
ImVec2(progress_bb.Min.x + unlocked_fraction * progress_bb.GetWidth(), progress_bb.Max.y),
2655-
progress_color);
2657+
progress_color, progress_rounding);
26562658

26572659
buffer.format("{}/{}", s_state.game_summary.num_unlocked_achievements, s_state.game_summary.num_core_achievements);
26582660
text_size =
@@ -2845,13 +2847,15 @@ void Achievements::DrawAchievementsWindow()
28452847
if (s_state.game_summary.num_core_achievements > 0)
28462848
{
28472849
const float progress_height = LayoutScale(20.0f);
2850+
const float progress_rounding = LayoutScale(5.0f);
28482851
const ImRect progress_bb(ImVec2(left, top), ImVec2(right, top + progress_height));
28492852
const float fraction = static_cast<float>(s_state.game_summary.num_unlocked_achievements) /
28502853
static_cast<float>(s_state.game_summary.num_core_achievements);
2851-
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor));
2854+
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor),
2855+
progress_rounding);
28522856
dl->AddRectFilled(progress_bb.Min,
28532857
ImVec2(progress_bb.Min.x + fraction * progress_bb.GetWidth(), progress_bb.Max.y),
2854-
ImGui::GetColorU32(UIStyle.SecondaryColor));
2858+
ImGui::GetColorU32(UIStyle.SecondaryColor), progress_rounding);
28552859

28562860
text.format("{}%", static_cast<int>(std::round(fraction * 100.0f)));
28572861
text_size =
@@ -2950,6 +2954,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
29502954
static constexpr float alpha = 0.8f;
29512955
static constexpr float progress_height_unscaled = 20.0f;
29522956
static constexpr float progress_spacing_unscaled = 5.0f;
2957+
static constexpr float progress_rounding_unscaled = 5.0f;
29532958
static constexpr float spacing_unscaled = 4.0f;
29542959

29552960
const float spacing = ImGuiFullscreen::LayoutScale(spacing_unscaled);
@@ -3082,13 +3087,15 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
30823087
ImDrawList* dl = ImGui::GetWindowDrawList();
30833088
const float progress_height = LayoutScale(progress_height_unscaled);
30843089
const float progress_spacing = LayoutScale(progress_spacing_unscaled);
3090+
const float progress_rounding = LayoutScale(progress_rounding_unscaled);
30853091
const ImRect progress_bb(summary_bb.Min.x, unlock_rarity_bb.Max.y + progress_spacing,
30863092
summary_bb.Max.x - progress_spacing,
30873093
unlock_rarity_bb.Max.y + progress_spacing + progress_height);
30883094
const float fraction = cheevo->measured_percent * 0.01f;
3089-
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(ImGuiFullscreen::UIStyle.PrimaryDarkColor));
3095+
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(ImGuiFullscreen::UIStyle.PrimaryDarkColor),
3096+
progress_rounding);
30903097
dl->AddRectFilled(progress_bb.Min, ImVec2(progress_bb.Min.x + fraction * progress_bb.GetWidth(), progress_bb.Max.y),
3091-
ImGui::GetColorU32(ImGuiFullscreen::UIStyle.SecondaryColor));
3098+
ImGui::GetColorU32(ImGuiFullscreen::UIStyle.SecondaryColor), progress_rounding);
30923099

30933100
const ImVec2 text_size =
30943101
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, measured_progress.data(),

0 commit comments

Comments
 (0)