@@ -347,6 +347,8 @@ void FullscreenUI::DrawNotifications(NotificationLayout& layout)
347347 const float note_icon_size = ImCeil (LAYOUT_LARGE_FONT_SIZE * scale);
348348 const ImVec4 left_background_color = DarkerColor (UIStyle.ToastBackgroundColor , 1 .3f );
349349 const ImVec4 right_background_color = DarkerColor (UIStyle.ToastBackgroundColor , 0 .8f );
350+ const bool blur_background = g_gpu_settings.display_blur_message_backgrounds && !FullscreenUI::HasActiveWindow () &&
351+ FullscreenUI::CanBlurBackground ();
350352 ImDrawList* const dl = ImGui::GetForegroundDrawList ();
351353
352354 for (auto iter = s_achievements_locals.notifications .begin (); iter != s_achievements_locals.notifications .end ();)
@@ -468,15 +470,24 @@ void FullscreenUI::DrawNotifications(NotificationLayout& layout)
468470
469471 const ImVec2 box_min (expected_pos.x , actual_y);
470472 const ImVec2 box_max (box_min.x + box_width, box_min.y + box_height);
471- const float background_opacity = opacity * 0 .95f ;
472- const float min_rounded_width = horizontal_padding * 2 .0f ;
473473
474- DrawRoundedGradientRect (
475- dl, box_min, box_max, ImGui::GetColorU32 (ModAlpha (left_background_color, background_opacity)),
476- ImGui::GetColorU32 (ModAlpha (ImLerp (left_background_color, right_background_color,
477- (box_width - min_rounded_width) / (max_width - min_rounded_width)),
478- background_opacity)),
479- horizontal_padding);
474+ if (blur_background && BeginBlurBackground (dl, box_min, box_max))
475+ {
476+ dl->AddRectFilled (box_min, box_max, ImGui::GetColorU32 (ModAlpha (left_background_color, opacity)),
477+ horizontal_padding);
478+ EndBlurBackground (dl);
479+ }
480+ else
481+ {
482+ const float background_opacity = opacity * 0 .95f ;
483+ const float min_rounded_width = horizontal_padding * 2 .0f ;
484+ DrawRoundedGradientRect (
485+ dl, box_min, box_max, ImGui::GetColorU32 (ModAlpha (left_background_color, background_opacity)),
486+ ImGui::GetColorU32 (ModAlpha (ImLerp (left_background_color, right_background_color,
487+ (box_width - min_rounded_width) / (max_width - min_rounded_width)),
488+ background_opacity)),
489+ horizontal_padding);
490+ }
480491
481492 const ImVec2 badge_min (box_min.x + horizontal_padding, box_min.y + vertical_padding);
482493 const ImVec2 badge_max (badge_min.x + badge_size, badge_min.y + badge_size);
@@ -561,7 +572,9 @@ void FullscreenUI::DrawIndicators(NotificationLayout& layout)
561572 const float image_size = ImCeil (50 .0f * scale);
562573 const float font_size = ImCeil (LAYOUT_MEDIUM_FONT_SIZE * scale);
563574 const ImGuiIO& io = ImGui::GetIO ();
564- ImDrawList* dl = ImGui::GetBackgroundDrawList ();
575+ const bool blur_background = g_gpu_settings.display_blur_message_backgrounds && !FullscreenUI::HasActiveWindow () &&
576+ FullscreenUI::CanBlurBackground ();
577+ ImDrawList* const dl = ImGui::GetBackgroundDrawList ();
565578
566579 if (std::vector<Achievements::ActiveChallengeIndicator>& indicators = Achievements::GetActiveChallengeIndicators ();
567580 !indicators.empty () &&
@@ -628,9 +641,17 @@ void FullscreenUI::DrawIndicators(NotificationLayout& layout)
628641 Achievements::INDICATOR_FADE_OUT_TIME, INDICATOR_WIDTH_COEFF);
629642 const ImVec2 box_max = box_min + ImVec2 (box_width, box_height);
630643
631- DrawRoundedGradientRect (dl, box_min, box_max,
632- ImGui::GetColorU32 (ModAlpha (left_background_color, opacity * bg_opacity)),
633- ImGui::GetColorU32 (ModAlpha (right_background_color, opacity * bg_opacity)), rounding);
644+ if (blur_background && BeginBlurBackground (dl, box_min, box_max))
645+ {
646+ dl->AddRectFilled (box_min, box_max, ImGui::GetColorU32 (ModAlpha (left_background_color, opacity)), rounding);
647+ EndBlurBackground (dl);
648+ }
649+ else
650+ {
651+ DrawRoundedGradientRect (dl, box_min, box_max,
652+ ImGui::GetColorU32 (ModAlpha (left_background_color, opacity * bg_opacity)),
653+ ImGui::GetColorU32 (ModAlpha (right_background_color, opacity * bg_opacity)), rounding);
654+ }
634655
635656 GPUTexture* const badge = FullscreenUI::GetCachedTextureAsync (indicator->badge_path );
636657 if (badge)
@@ -676,26 +697,34 @@ void FullscreenUI::DrawIndicators(NotificationLayout& layout)
676697 return UIStyle.Font ->CalcTextSizeA (font_size, font_weight, FLT_MAX, 0 .0f , IMSTR_START_END (tstr));
677698 };
678699
679- const auto draw_tracker = [&padding, &rounding, &font_size, &dl, &left_background_color, &right_background_color,
680- &tstr , &measure_tracker](Achievements::LeaderboardTrackerIndicator& indicator ,
681- const ImVec2& pos, float opacity) {
682- const ImVec2 size = measure_tracker (indicator);
683- const float box_width = size.x + padding.x * 2 .0f ;
684- const float box_height = size.y + padding.y * 2 .0f ;
685- const ImRect box (pos, ImVec2 (pos.x + box_width, pos.y + box_height));
700+ const auto draw_tracker =
701+ [&padding, &rounding, &font_size, &blur_background, &dl, &left_background_color , &right_background_color, &tstr ,
702+ &measure_tracker](Achievements::LeaderboardTrackerIndicator& indicator, const ImVec2& pos, float opacity) {
703+ const ImVec2 size = measure_tracker (indicator);
704+ const float box_width = size.x + padding.x * 2 .0f ;
705+ const float box_height = size.y + padding.y * 2 .0f ;
706+ const ImRect box (pos, ImVec2 (pos.x + box_width, pos.y + box_height));
686707
687- DrawRoundedGradientRect (dl, box.Min , box.Max ,
688- ImGui::GetColorU32 (ModAlpha (left_background_color, opacity * bg_opacity)),
689- ImGui::GetColorU32 (ModAlpha (right_background_color, opacity * bg_opacity)), rounding);
708+ if (blur_background && BeginBlurBackground (dl, box.Min , box.Max ))
709+ {
710+ dl->AddRectFilled (box.Min , box.Max , ImGui::GetColorU32 (ModAlpha (left_background_color, opacity)), rounding);
711+ EndBlurBackground (dl);
712+ }
713+ else
714+ {
715+ DrawRoundedGradientRect (dl, box.Min , box.Max ,
716+ ImGui::GetColorU32 (ModAlpha (left_background_color, opacity * bg_opacity)),
717+ ImGui::GetColorU32 (ModAlpha (right_background_color, opacity * bg_opacity)), rounding);
718+ }
690719
691- tstr.format (ICON_FA_STOPWATCH " {}" , indicator.text );
720+ tstr.format (ICON_FA_STOPWATCH " {}" , indicator.text );
692721
693- const u32 text_col = ImGui::GetColorU32 (ModAlpha (UIStyle.ToastTextColor , opacity));
694- RenderShadowedTextClipped (dl, UIStyle.Font , font_size, font_weight, box.Min + padding, box.Max , text_col, tstr,
695- nullptr , ImVec2 (0 .0f , 0 .0f ), 0 .0f , &box);
722+ const u32 text_col = ImGui::GetColorU32 (ModAlpha (UIStyle.ToastTextColor , opacity));
723+ RenderShadowedTextClipped (dl, UIStyle.Font , font_size, font_weight, box.Min + padding, box.Max , text_col, tstr,
724+ nullptr , ImVec2 (0 .0f , 0 .0f ), 0 .0f , &box);
696725
697- return box_width;
698- };
726+ return box_width;
727+ };
699728
700729 // animations are not currently handled for more than one tracker... but this should be rare
701730 if (trackers.size () > 1 )
@@ -938,7 +967,8 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
938967 const float box_padding = LayoutScale (15 .0f );
939968 const float box_content_width = box_width - box_padding - box_padding;
940969 const float box_rounding = LayoutScale (20 .0f );
941- const u32 box_background_color = ImGui::GetColorU32 (ModAlpha (UIStyle.PopupBackgroundColor , 0 .8f ));
970+ const u32 box_background_color =
971+ ImGui::GetColorU32 (ModAlpha (UIStyle.PopupBackgroundColor , UIStyle.BlurMenuBackground ? 1 .0f : 0 .8f ));
942972 const ImU32 box_title_text_color =
943973 ImGui::GetColorU32 (DarkerColor (UIStyle.BackgroundTextColor , 0 .9f )) | IM_COL32_A_MASK;
944974 const ImU32 title_text_color = ImGui::GetColorU32 (UIStyle.BackgroundTextColor ) | IM_COL32_A_MASK;
@@ -965,7 +995,15 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
965995 ImVec2 text_size;
966996 TinyString buffer;
967997
968- dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
998+ if (UIStyle.BlurMenuBackground && BeginBlurBackground (dl, box_min, box_max))
999+ {
1000+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1001+ EndBlurBackground (dl);
1002+ }
1003+ else
1004+ {
1005+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1006+ }
9691007
9701008 // title
9711009 {
@@ -1037,7 +1075,15 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
10371075 box_max = ImVec2 (box_min.x + box_width, box_min.y + box_height);
10381076 text_pos = ImVec2 (box_min.x + box_padding, box_min.y + box_padding);
10391077
1040- dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1078+ if (UIStyle.BlurMenuBackground && BeginBlurBackground (dl, box_min, box_max))
1079+ {
1080+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1081+ EndBlurBackground (dl);
1082+ }
1083+ else
1084+ {
1085+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1086+ }
10411087
10421088 ImVec4 clip_rect = ImVec4 (text_pos.x , text_pos.y , text_pos.x + box_content_width, box_max.y );
10431089 dl->AddText (UIStyle.Font , UIStyle.MediumFontSize , UIStyle.BoldFontWeight , text_pos, box_title_text_color,
@@ -1227,7 +1273,15 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
12271273 box_max = ImVec2 (box_min.x + box_width, box_min.y + box_height);
12281274 text_pos = ImVec2 (box_min.x + box_padding, box_min.y + box_padding);
12291275
1230- dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1276+ if (UIStyle.BlurMenuBackground && BeginBlurBackground (dl, box_min, box_max))
1277+ {
1278+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1279+ EndBlurBackground (dl);
1280+ }
1281+ else
1282+ {
1283+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1284+ }
12311285
12321286 buffer.format (ICON_FA_HAND_FIST " {}" ,
12331287 TRANSLATE_DISAMBIG_SV (" Achievements" , " Active Challenge Achievements" , " Pause Menu" ));
@@ -1287,7 +1341,15 @@ void FullscreenUI::DrawAchievementsPauseMenuOverlays(float start_pos_y)
12871341 box_max = ImVec2 (box_min.x + box_width, box_min.y + box_height);
12881342 text_pos = ImVec2 (box_min.x + box_padding, box_min.y + box_padding);
12891343
1290- dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1344+ if (UIStyle.BlurMenuBackground && BeginBlurBackground (dl, box_min, box_max))
1345+ {
1346+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1347+ EndBlurBackground (dl);
1348+ }
1349+ else
1350+ {
1351+ dl->AddRectFilled (box_min, box_max, box_background_color, box_rounding);
1352+ }
12911353
12921354 buffer.format (ICON_FA_STOPWATCH " {}" ,
12931355 TRANSLATE_DISAMBIG_SV (" Achievements" , " Active Leaderboard Attempts" , " Pause Menu" ));
@@ -1627,15 +1689,15 @@ void FullscreenUI::DrawAchievementsWindow()
16271689 ((summary.num_unsupported_achievements > 0 ) ? 20 .0f : 0 .0f );
16281690
16291691 const ImVec4 background = ModAlpha (UIStyle.BackgroundColor , WINDOW_ALPHA);
1630- const ImVec4 heading_background = ModAlpha (UIStyle.BackgroundColor , WINDOW_HEADING_ALPHA);
1692+ const ImVec4 heading_background = ModAlpha (DarkerColor ( UIStyle.BackgroundColor , 1 . 5f ) , WINDOW_HEADING_ALPHA);
16311693 const ImVec2 display_size = ImGui::GetIO ().DisplaySize ;
16321694 const float heading_height = LayoutScale (heading_height_unscaled);
16331695 bool close_window = false ;
16341696
16351697 if (BeginFullscreenWindow (ImVec2 (), ImVec2 (display_size.x , heading_height), " achievements_heading" ,
16361698 heading_background, 0 .0f , ImVec2 (10 .0f , 10 .0f ),
1637- ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration |
1638- ImGuiWindowFlags_NoScrollWithMouse ))
1699+ ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse,
1700+ true ))
16391701 {
16401702 const ImVec2 pos = ImGui::GetCursorScreenPos () + ImGui::GetStyle ().FramePadding ;
16411703 const float spacing = LayoutScale (LAYOUT_MENU_ITEM_TITLE_SUMMARY_SPACING);
@@ -1825,7 +1887,7 @@ void FullscreenUI::DrawAchievementsWindow()
18251887 if (BeginFullscreenWindow (ImVec2 (0 .0f , heading_height),
18261888 ImVec2 (display_size.x , display_size.y - heading_height - LayoutScale (LAYOUT_FOOTER_HEIGHT)),
18271889 " achievements" , background, 0 .0f ,
1828- ImVec2 (LAYOUT_MENU_WINDOW_X_PADDING, LAYOUT_MENU_WINDOW_Y_PADDING), 0 ))
1890+ ImVec2 (LAYOUT_MENU_WINDOW_X_PADDING, LAYOUT_MENU_WINDOW_Y_PADDING), 0 , true ))
18291891 {
18301892 static constexpr std::pair<const char *, const char *> bucket_names[] = {
18311893 {ICON_FA_CIRCLE_QUESTION, TRANSLATE_NOOP (" Achievements" , " Unknown" )},
@@ -2207,7 +2269,7 @@ void FullscreenUI::DrawLeaderboardsWindow()
22072269 SmallString text;
22082270
22092271 const ImVec4 background = ModAlpha (UIStyle.BackgroundColor , WINDOW_ALPHA);
2210- const ImVec4 heading_background = ModAlpha (UIStyle.BackgroundColor , WINDOW_HEADING_ALPHA);
2272+ const ImVec4 heading_background = ModAlpha (DarkerColor ( UIStyle.BackgroundColor , 1 . 5f ) , WINDOW_HEADING_ALPHA);
22112273 const ImVec2 display_size = ImGui::GetIO ().DisplaySize ;
22122274 const u32 text_color = ImGui::GetColorU32 (ImGuiCol_Text);
22132275 const float spacing = LayoutScale (10 .0f );
@@ -2216,8 +2278,8 @@ void FullscreenUI::DrawLeaderboardsWindow()
22162278
22172279 if (BeginFullscreenWindow (ImVec2 (), ImVec2 (display_size.x , heading_height), " leaderboards_heading" ,
22182280 heading_background, 0 .0f , ImVec2 (10 .0f , 10 .0f ),
2219- ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration |
2220- ImGuiWindowFlags_NoScrollWithMouse ))
2281+ ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse,
2282+ true ))
22212283 {
22222284 const ImVec2 heading_pos = ImGui::GetCursorScreenPos () + ImGui::GetStyle ().FramePadding ;
22232285 const float image_size = LayoutScale (75 .0f );
@@ -2369,7 +2431,7 @@ void FullscreenUI::DrawLeaderboardsWindow()
23692431 if (BeginFullscreenWindow (
23702432 ImVec2 (0 .0f , heading_height),
23712433 ImVec2 (display_size.x , display_size.y - heading_height - LayoutScale (LAYOUT_FOOTER_HEIGHT)), " leaderboards" ,
2372- background, 0 .0f , ImVec2 (LAYOUT_MENU_WINDOW_X_PADDING, LAYOUT_MENU_WINDOW_Y_PADDING), 0 ))
2434+ background, 0 .0f , ImVec2 (LAYOUT_MENU_WINDOW_X_PADDING, LAYOUT_MENU_WINDOW_Y_PADDING), 0 , true ))
23732435 {
23742436 ResetFocusHere ();
23752437 BeginMenuButtons ();
@@ -2430,7 +2492,7 @@ void FullscreenUI::DrawLeaderboardsWindow()
24302492 if (BeginFullscreenWindow (
24312493 ImVec2 (0 .0f , heading_height),
24322494 ImVec2 (display_size.x , display_size.y - heading_height - LayoutScale (LAYOUT_FOOTER_HEIGHT)), " leaderboard" ,
2433- background, 0 .0f , ImVec2 (LAYOUT_MENU_WINDOW_X_PADDING, LAYOUT_MENU_WINDOW_Y_PADDING), 0 ))
2495+ background, 0 .0f , ImVec2 (LAYOUT_MENU_WINDOW_X_PADDING, LAYOUT_MENU_WINDOW_Y_PADDING), 0 , true ))
24342496 {
24352497 const ImVec2 heading_start_pos = ImGui::GetCursorScreenPos ();
24362498 ImVec2 column_heading_pos = heading_start_pos;
0 commit comments