(MaterialUI) Hook up framebuffer opacity

This commit is contained in:
twinaphex 2017-08-15 22:43:09 +02:00
parent 5c6b230e42
commit ef79711837
7 changed files with 43 additions and 29 deletions

View File

@ -2524,7 +2524,8 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->battery_level_enable = settings->bools.menu_battery_level_enable;
video_info->xmb_shadows_enable = settings->bools.menu_xmb_shadows_enable;
video_info->xmb_alpha_factor = settings->uints.menu_xmb_alpha_factor;
video_info->menu_wallpaper_opacity = settings->floats.menu_wallpaper_opacity;
video_info->menu_wallpaper_opacity = settings->floats.menu_wallpaper_opacity;
video_info->menu_framebuffer_opacity = settings->floats.menu_framebuffer_opacity;
video_info->libretro_running = core_is_game_loaded();
#else
@ -2539,6 +2540,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->battery_level_enable = false;
video_info->xmb_shadows_enable = false;
video_info->xmb_alpha_factor = 0.0f;
video_info->menu_framebuffer_opacity = 0.0f;
video_info->menu_wallpaper_opacity = 0.0f;
#endif

View File

@ -447,14 +447,15 @@ typedef struct video_frame_info
unsigned custom_vp_full_height;
float menu_wallpaper_opacity;
float menu_framebuffer_opacity;
float menu_header_opacity;
float menu_footer_opacity;
float refresh_rate;
float font_msg_pos_x;
float font_msg_pos_y;
float font_msg_color_r;
float font_msg_color_g;
float font_msg_color_b;
float menu_header_opacity;
float menu_footer_opacity;
float xmb_alpha_factor;
char fps_text[128];

View File

@ -1095,6 +1095,9 @@ static int mui_get_core_title(char *s, size_t len)
static void mui_draw_bg(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
bool add_opacity = false;
float opacity_override = video_info->menu_wallpaper_opacity;
menu_display_blend_begin();
draw->x = 0;
@ -1102,7 +1105,14 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw,
draw->pipeline.id = 0;
draw->pipeline.active = false;
menu_display_draw_bg(draw, video_info, false);
if (video_info->libretro_running)
{
add_opacity = true;
opacity_override = video_info->menu_framebuffer_opacity;
}
menu_display_draw_bg(draw, video_info, add_opacity,
opacity_override);
menu_display_draw(draw);
menu_display_blend_end();
}
@ -1124,6 +1134,17 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
char title[255];
char title_buf[255];
char title_msg[255];
float black_bg[16];
float pure_white[16];
float white_bg[16];
float white_transp_bg[16];
float grey_bg[16];
float shadow_bg[16]= {
0.00, 0.00, 0.00, 0.00,
0.00, 0.00, 0.00, 0.00,
0.00, 0.00, 0.00, 0.20,
0.00, 0.00, 0.00, 0.20,
};
file_list_t *list = NULL;
mui_node_t *node = NULL;
@ -1164,29 +1185,13 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
uint32_t black_opaque_87 = 0x000000DE;
uint32_t white_opaque_70 = 0xFFFFFFB3;
/* Pallete of colors needed throughout the file */
float black_bg[16];
/* Palette of colors needed throughout the file */
hex32_to_rgba_normalized(0x000000, black_bg, 0.75);
float pure_white[16];
hex32_to_rgba_normalized(0xFFFFFF, pure_white, 1.0);
float white_bg[16];
hex32_to_rgba_normalized(0xFAFAFA, white_bg, 1.0);
float white_transp_bg[16];
hex32_to_rgba_normalized(0xFAFAFA, white_transp_bg, 0.90);
float grey_bg[16];
hex32_to_rgba_normalized(0xC7C7C7, grey_bg, 0.90);
float shadow_bg[16]= {
0.00, 0.00, 0.00, 0.00,
0.00, 0.00, 0.00, 0.00,
0.00, 0.00, 0.00, 0.20,
0.00, 0.00, 0.00, 0.20,
};
memcpy(theme.passive_tab_icon_color, grey_bg, sizeof(grey_bg));
switch (video_info->materialui_color_theme)

View File

@ -2614,8 +2614,10 @@ static void xmb_draw_bg(
menu_display_draw_gradient(&draw, video_info);
{
bool add_opacity = false;
draw.texture = texture;
float override_opacity = video_info->menu_wallpaper_opacity;
bool add_opacity = false;
draw.texture = texture;
menu_display_set_alpha(draw.color, coord_white[3]);
if (draw.texture)
@ -2624,7 +2626,7 @@ static void xmb_draw_bg(
if (running || video_info->xmb_color_theme == XMB_THEME_WALLPAPER)
add_opacity = true;
menu_display_draw_bg(&draw, video_info, add_opacity);
menu_display_draw_bg(&draw, video_info, add_opacity, override_opacity);
}
}

View File

@ -976,7 +976,9 @@ static void zarch_frame(void *data, video_frame_info_t *video_info)
menu_display_blend_begin();
draw.x = 0;
draw.y = 0;
menu_display_draw_bg(&draw, video_info, false);
menu_display_draw_bg(&draw, video_info, false,
video_info->menu_wallpaper_opacity);
menu_display_draw(&draw);
menu_display_blend_end();

View File

@ -578,7 +578,8 @@ void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw)
}
void menu_display_draw_bg(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info, bool add_opacity_to_wallpaper)
video_frame_info_t *video_info, bool add_opacity_to_wallpaper,
float override_opacity)
{
static struct video_coords coords;
const float *new_vertex = NULL;
@ -606,7 +607,7 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw,
add_opacity_to_wallpaper = true;
if (add_opacity_to_wallpaper)
menu_display_set_alpha(draw->color, video_info->menu_wallpaper_opacity);
menu_display_set_alpha(draw->color, override_opacity);
if (!draw->texture)
draw->texture = menu_display_white_texture;
@ -621,7 +622,8 @@ void menu_display_draw_gradient(menu_display_ctx_draw_t *draw,
draw->x = 0;
draw->y = 0;
menu_display_draw_bg(draw, video_info, false);
menu_display_draw_bg(draw, video_info, false,
video_info->menu_wallpaper_opacity);
menu_display_draw(draw);
}

View File

@ -669,7 +669,7 @@ void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw);
void menu_display_draw_bg(
menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info,
bool add_opacity);
bool add_opacity, float opacity_override);
void menu_display_draw_gradient(
menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info);