mirror of
https://github.com/stenzek/duckstation.git
synced 2026-07-11 01:24:11 +02:00
Achievements: Add alpha to progress bars
This commit is contained in:
@@ -36,6 +36,7 @@ static constexpr const char* PROFILE_DETAILS_URL_TEMPLATE = "https://retroachiev
|
||||
|
||||
static constexpr float WINDOW_ALPHA = 0.9f;
|
||||
static constexpr float WINDOW_HEADING_ALPHA = 0.95f;
|
||||
static constexpr float PROGRESS_BAR_ALPHA = 0.5f;
|
||||
|
||||
static constexpr u32 LEADERBOARD_NEARBY_ENTRIES_TO_FETCH = 20;
|
||||
static constexpr u32 LEADERBOARD_ALL_FETCH_SIZE = 50;
|
||||
@@ -1070,7 +1071,7 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
|
||||
const ImVec2 display_margin = LayoutScale(16.0f, 16.0f);
|
||||
const float box_margin = LayoutScale(10.0f);
|
||||
const float box_width = LayoutScale(450.0f);
|
||||
const float box_padding = LayoutScale(15.0f);
|
||||
const float box_padding = LayoutScale(10.0f);
|
||||
const float box_content_width = box_width - box_padding - box_padding;
|
||||
const float box_rounding = LayoutScale(20.0f);
|
||||
const u32 box_background_color =
|
||||
@@ -1130,8 +1131,8 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
|
||||
text_pos.y += UIStyle.MediumFontSize + paragraph_spacing;
|
||||
|
||||
const ImRect progress_bb(text_pos, text_pos + ImVec2(box_content_width, progress_height));
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor),
|
||||
progress_rounding);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max,
|
||||
ImGui::GetColorU32(ModAlpha(UIStyle.PrimaryDarkColor, PROGRESS_BAR_ALPHA)), progress_rounding);
|
||||
if (summary.num_unlocked_achievements > 0)
|
||||
{
|
||||
ImGui::RenderRectFilledInRangeH(
|
||||
@@ -1201,8 +1202,8 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
|
||||
const float progress_height = UIStyle.MediumFontSize;
|
||||
const ImRect progress_bb(ImVec2(text_pos.x + box_content_width - progress_width, text_pos.y),
|
||||
ImVec2(text_pos.x + box_content_width, text_pos.y + progress_height));
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor),
|
||||
progress_rounding);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max,
|
||||
ImGui::GetColorU32(ModAlpha(UIStyle.PrimaryDarkColor, PROGRESS_BAR_ALPHA)), progress_rounding);
|
||||
if (measured_percent > 0.0f)
|
||||
{
|
||||
ImGui::RenderRectFilledInRangeH(
|
||||
@@ -1991,8 +1992,8 @@ void FullscreenUI::DrawAchievementsWindow()
|
||||
const ImRect progress_bb(ImVec2(left, top), ImVec2(right, top + progress_height));
|
||||
const float fraction =
|
||||
static_cast<float>(summary.num_unlocked_achievements) / static_cast<float>(summary.num_core_achievements);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor),
|
||||
progress_rounding);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max,
|
||||
ImGui::GetColorU32(ModAlpha(UIStyle.PrimaryDarkColor, PROGRESS_BAR_ALPHA)), progress_rounding);
|
||||
if (summary.num_unlocked_achievements > 0)
|
||||
{
|
||||
ImGui::RenderRectFilledInRangeH(dl, progress_bb, ImGui::GetColorU32(UIStyle.SecondaryColor), progress_bb.Min.x,
|
||||
@@ -2320,8 +2321,8 @@ void FullscreenUI::DrawAchievement(const rc_client_achievement_t* cheevo, const
|
||||
const ImRect progress_bb(
|
||||
current_pos, ImVec2(current_pos.x + max_text_width, current_pos.y + LayoutScale(progress_height_unscaled)));
|
||||
const float fraction = cheevo->measured_percent * 0.01f;
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor),
|
||||
progress_rounding);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max,
|
||||
ImGui::GetColorU32(ModAlpha(UIStyle.PrimaryDarkColor, PROGRESS_BAR_ALPHA)), progress_rounding);
|
||||
ImGui::RenderRectFilledInRangeH(dl, progress_bb, ImGui::GetColorU32(UIStyle.SecondaryColor), progress_bb.Min.x,
|
||||
progress_bb.Min.x + (fraction * progress_bb.GetWidth()), progress_rounding);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user