mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
overlays: add background overlay image
This commit is contained in:
parent
b2ff24453c
commit
7cd5d812d2
2 changed files with 39 additions and 1 deletions
|
@ -96,6 +96,11 @@ namespace rsx
|
|||
if (background_image && background_image->get_data())
|
||||
{
|
||||
result.add(background_poster.get_compiled());
|
||||
|
||||
if (background_overlay_image && background_overlay_image->get_data())
|
||||
{
|
||||
result.add(background_overlay_poster.get_compiled());
|
||||
}
|
||||
}
|
||||
|
||||
result.add(background.get_compiled());
|
||||
|
@ -357,15 +362,27 @@ namespace rsx
|
|||
|
||||
if (!background_image)
|
||||
{
|
||||
game_content_type background_content_type = game_content_type::background_picture;
|
||||
|
||||
for (game_content_type type : { game_content_type::background_picture, game_content_type::content_icon, game_content_type::overlay_picture })
|
||||
{
|
||||
if (const std::string picture_path = rpcs3::utils::get_game_content_path(type); fs::is_file(picture_path))
|
||||
{
|
||||
background_content_type = type;
|
||||
background_image = std::make_unique<image_info>(picture_path);
|
||||
dirty |= !!background_image->get_data();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (background_image && !background_overlay_image && background_content_type == game_content_type::background_picture)
|
||||
{
|
||||
if (const std::string picture_path = rpcs3::utils::get_game_content_path(game_content_type::overlay_picture); fs::is_file(picture_path))
|
||||
{
|
||||
background_overlay_image = std::make_unique<image_info>(picture_path);
|
||||
dirty |= !!background_overlay_image->get_data();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty && background_image && background_image->get_data())
|
||||
|
@ -393,6 +410,17 @@ namespace rsx
|
|||
const int padding = (background_poster.w - static_cast<int>(background_image->w * (background_poster.h / static_cast<double>(background_image->h)))) / 2;
|
||||
background_poster.set_padding(padding, padding, 0, 0);
|
||||
}
|
||||
|
||||
if (background_overlay_image && background_overlay_image->get_data())
|
||||
{
|
||||
const f32 color = (100 - background_darkening_strength) / 100.f;
|
||||
background_overlay_poster.fore_color = color4f(color, color, color, 1.);
|
||||
|
||||
background_overlay_poster.set_pos(std::min(virtual_width - background_overlay_image->w, virtual_width * 2 / 3), (virtual_height - background_overlay_image->h) / 2);
|
||||
background_overlay_poster.set_size(background_overlay_image->w, background_overlay_image->h);
|
||||
background_overlay_poster.set_raw_image(background_overlay_image.get());
|
||||
background_overlay_poster.set_blur_strength(static_cast<u8>(background_blur_strength));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -402,6 +430,13 @@ namespace rsx
|
|||
background_poster.clear_image();
|
||||
background_image.reset();
|
||||
}
|
||||
|
||||
if (background_overlay_image)
|
||||
{
|
||||
background_overlay_poster.clear_image();
|
||||
background_overlay_image.reset();
|
||||
}
|
||||
|
||||
background.back_color.a = 0.85f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,10 @@ namespace rsx
|
|||
image_button btn_ok;
|
||||
image_button btn_cancel;
|
||||
|
||||
overlay_element bottom_bar, background;
|
||||
overlay_element bottom_bar;
|
||||
overlay_element background;
|
||||
image_view background_poster;
|
||||
image_view background_overlay_poster;
|
||||
std::array<progress_bar, 2> progress_bars{};
|
||||
u8 num_progress_bars = 0;
|
||||
s32 taskbar_index = 0;
|
||||
|
@ -31,6 +33,7 @@ namespace rsx
|
|||
u32 background_blur_strength = 0;
|
||||
u32 background_darkening_strength = 0;
|
||||
std::unique_ptr<image_info> background_image;
|
||||
std::unique_ptr<image_info> background_overlay_image;
|
||||
|
||||
animation_color_interpolate fade_animation;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue