(Menu) Cleanups

This commit is contained in:
twinaphex 2020-03-09 14:46:23 +01:00
parent 82b327420d
commit 540f0d2646
6 changed files with 160 additions and 56 deletions

View File

@ -5029,24 +5029,26 @@ static void materialui_update_scrollbar(
* Draws all menu elements */
static void materialui_frame(void *data, video_frame_info_t *video_info)
{
materialui_handle_t *mui = (materialui_handle_t*)data;
settings_t *settings = config_get_ptr();
void *userdata = video_info->userdata;
unsigned width = video_info->width;
unsigned height = video_info->height;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
unsigned
materialui_color_theme = video_info->materialui_color_theme;
unsigned header_height = gfx_display_get_header_height();
size_t selection = menu_navigation_get_selection();
int list_x_offset;
materialui_handle_t *mui = (materialui_handle_t*)data;
settings_t *settings = config_get_ptr();
unsigned header_height = gfx_display_get_header_height();
size_t selection = menu_navigation_get_selection();
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
bool menu_ticker_smooth = settings->bools.menu_ticker_smooth;
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
bool menu_ticker_smooth = settings->bools.menu_ticker_smooth;
bool libretro_running = video_info->libretro_running;
float menu_wallpaper_opacity = video_info->menu_wallpaper_opacity;
float menu_framebuffer_opacity = video_info->menu_framebuffer_opacity;
void *userdata = video_info->userdata;
unsigned width = video_info->width;
unsigned height = video_info->height;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
unsigned
materialui_color_theme = video_info->materialui_color_theme;
bool video_fullscreen = video_info->fullscreen;
bool menu_mouse_enable = video_info->menu_mouse_enable;
if (!mui)
return;
@ -5237,8 +5239,8 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f
};
bool cursor_visible = video_info->fullscreen
&& video_info->menu_mouse_enable;
bool cursor_visible = video_fullscreen
&& menu_mouse_enable;
gfx_display_draw_cursor(
userdata,

View File

@ -1556,7 +1556,9 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
#if 0
if (discord_avatar_is_ready())
ozone_draw_icon(
video_info,
userdata,
video_width,
video_height,
logo_icon_size,
logo_icon_size,
ozone->textures[OZONE_TEXTURE_DISCORD_OWN_AVATAR],
@ -1568,7 +1570,9 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
else
#endif
ozone_draw_icon(
video_info,
userdata,
video_width,
video_height,
logo_icon_size,
logo_icon_size,
ozone->textures[OZONE_TEXTURE_RETROARCH],
@ -1600,7 +1604,9 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
gfx_display_blend_begin(userdata);
ozone_draw_icon(
video_info,
userdata,
video_width,
video_height,
status_icon_size,
status_icon_size,
ozone->icons_textures[powerstate.charging? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_CHARGING : (powerstate.percent > 80)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_FULL : (powerstate.percent > 60)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_80 : (powerstate.percent > 40)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_60 : (powerstate.percent > 20)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_40 : OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_20],
@ -1631,7 +1637,9 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
gfx_display_blend_begin(userdata);
ozone_draw_icon(
video_info,
userdata,
video_width,
video_height,
status_icon_size,
status_icon_size,
ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOCK],
@ -1644,15 +1652,16 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
}
}
static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_info, settings_t *settings)
static void ozone_draw_footer(ozone_handle_t *ozone,
void *userdata,
unsigned video_width,
unsigned video_height,
bool input_menu_swap_ok_cancel_buttons,
settings_t *settings)
{
float scale_factor = ozone->last_scale_factor;
unsigned seperator_margin = 30 * scale_factor;
bool menu_core_enable = settings->bools.menu_core_enable;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
bool input_menu_swap_ok_cancel_buttons = video_info->input_menu_swap_ok_cancel_buttons;
/* Separator */
gfx_display_draw_quad(
@ -1675,7 +1684,20 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_draw_text(ozone, core_title, 59 * scale_factor, video_height - ozone->dimensions.footer_height / 2 + ozone->footer_font_glyph_height * 3.0f/10.0f, TEXT_ALIGN_LEFT, video_width, video_height, ozone->fonts.footer, ozone->theme->text_rgba, false);
}
else
ozone_draw_icon(video_info, 69 * scale_factor, 30 * scale_factor, ozone->theme->textures[OZONE_THEME_TEXTURE_SWITCH], 59 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - 15 * scale_factor, video_width, video_height, 0, 1, NULL);
ozone_draw_icon(
userdata,
video_width,
video_height,
69 * scale_factor,
30 * scale_factor,
ozone->theme->textures[OZONE_THEME_TEXTURE_SWITCH],
59 * scale_factor,
video_height - ozone->dimensions.footer_height / 2 - 15 * scale_factor,
video_width,
video_height,
0,
1,
NULL);
/* Buttons */
{
@ -1698,19 +1720,43 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i
if (input_menu_swap_ok_cancel_buttons)
{
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D], video_width - 138 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R], video_width - 256 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D], video_width - 138 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R], video_width - 256 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
}
else
{
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D], video_width - 256 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R], video_width - 138 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D], video_width - 256 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R], video_width - 138 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
}
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U], video_width - 384 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U], video_width - 384 * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width,video_height, 0, 1, ozone->theme_dynamic.entries_icon);
if (ozone->is_playlist && !ozone->cursor_in_sidebar)
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L], video_width - (384 + 118 + 100 + 50) * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width, video_height, 0, 1, ozone->theme_dynamic.entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L], video_width - (384 + 118 + 100 + 50) * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width, video_height, 0, 1, ozone->theme_dynamic.entries_icon);
gfx_display_blend_end(userdata);
@ -2046,6 +2092,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
bool libretro_running = video_info->libretro_running;
bool video_fullscreen = video_info->fullscreen;
bool menu_mouse_enable = video_info->menu_mouse_enable;
bool input_menu_swap_ok_cancel_buttons = video_info->input_menu_swap_ok_cancel_buttons;
#if 0
static bool reset = false;
@ -2140,7 +2187,12 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
/* Header, footer */
ozone_draw_header(ozone, video_info);
ozone_draw_footer(ozone, video_info, settings);
ozone_draw_footer(ozone,
userdata,
video_width,
video_height,
input_menu_swap_ok_cancel_buttons,
settings);
/* Sidebar */
ozone_draw_sidebar(ozone, video_info);

View File

@ -264,7 +264,9 @@ void ozone_draw_cursor(ozone_handle_t *ozone,
}
void ozone_draw_icon(
video_frame_info_t *video_info,
void *userdata,
unsigned video_width,
unsigned video_height,
unsigned icon_width,
unsigned icon_height,
uintptr_t texture,
@ -277,9 +279,6 @@ void ozone_draw_icon(
gfx_display_ctx_draw_t draw;
struct video_coords coords;
math_matrix_4x4 mymat;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = rotation;

View File

@ -37,7 +37,9 @@ void ozone_draw_cursor(ozone_handle_t *ozone,
size_t y, float alpha);
void ozone_draw_icon(
video_frame_info_t *video_info,
void *userdata,
unsigned video_width,
unsigned video_height,
unsigned icon_width,
unsigned icon_height,
uintptr_t texture,

View File

@ -67,7 +67,20 @@ static void ozone_draw_entry_value(ozone_handle_t *ozone,
if (entry->checked)
{
gfx_display_blend_begin(userdata);
ozone_draw_icon(video_info, 30 * scale_factor, 30 * scale_factor, ozone->theme->textures[OZONE_THEME_TEXTURE_CHECK], x - 20 * scale_factor, y - 22 * scale_factor, video_width, video_height, 0, 1, ozone->theme_dynamic.entries_checkmark);
ozone_draw_icon(
userdata,
video_width,
video_height,
30 * scale_factor,
30 * scale_factor,
ozone->theme->textures[OZONE_THEME_TEXTURE_CHECK],
x - 20 * scale_factor,
y - 22 * scale_factor,
video_width,
video_height,
0,
1,
ozone->theme_dynamic.entries_checkmark);
gfx_display_blend_end(userdata);
return;
}
@ -642,9 +655,20 @@ border_iterate:
gfx_display_set_alpha(icon_color, alpha);
gfx_display_blend_begin(userdata);
ozone_draw_icon(video_info, ozone->dimensions.entry_icon_size, ozone->dimensions.entry_icon_size, texture,
(unsigned) ozone->dimensions.sidebar_width + x_offset + entry_padding + ozone->dimensions.entry_icon_padding,
y + scroll_y + ozone->dimensions.entry_height / 2 - ozone->dimensions.entry_icon_size / 2, video_width, video_height, 0, 1, icon_color);
ozone_draw_icon(
userdata,
video_width,
video_height,
ozone->dimensions.entry_icon_size,
ozone->dimensions.entry_icon_size,
texture,
(unsigned)ozone->dimensions.sidebar_width + x_offset + entry_padding + ozone->dimensions.entry_icon_padding,
y + scroll_y + ozone->dimensions.entry_height / 2 - ozone->dimensions.entry_icon_size / 2,
video_width,
video_height,
0,
1,
icon_color);
gfx_display_blend_end(userdata);
if (icon_color == ozone_pure_white)
@ -718,15 +742,18 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
unsigned video_height = video_info->height;
gfx_display_blend_begin(userdata);
ozone_draw_icon(video_info,
icon_size,
icon_size,
ozone->icons_textures[icon],
x_position + sidebar_width/2 - icon_size/2,
video_height / 2 - icon_size/2 - y_offset,
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
ozone_draw_icon(
userdata,
video_width,
video_height,
icon_size,
icon_size,
ozone->icons_textures[icon],
x_position + sidebar_width/2 - icon_size/2,
video_height / 2 - icon_size/2 - y_offset,
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
gfx_display_blend_end(userdata);
ozone_draw_text(

View File

@ -248,9 +248,20 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
uint32_t text_color = COLOR_TEXT_ALPHA((selected ? ozone->theme->text_selected_rgba : ozone->theme->text_rgba), text_alpha);
/* Icon */
ozone_draw_icon(video_info, ozone->dimensions.sidebar_entry_icon_size, ozone->dimensions.sidebar_entry_icon_size,
ozone->tab_textures[icon], ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.sidebar_entry_icon_padding,
y + ozone->dimensions.sidebar_entry_height / 2 - ozone->dimensions.sidebar_entry_icon_size / 2 + ozone->animations.scroll_y_sidebar, video_width, video_height, 0, 1, (selected ? ozone->theme->text_selected : ozone->theme->entries_icon));
ozone_draw_icon(
userdata,
video_width,
video_height,
ozone->dimensions.sidebar_entry_icon_size,
ozone->dimensions.sidebar_entry_icon_size,
ozone->tab_textures[icon],
ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.sidebar_entry_icon_padding,
y + ozone->dimensions.sidebar_entry_height / 2 - ozone->dimensions.sidebar_entry_icon_size / 2 + ozone->animations.scroll_y_sidebar,
video_width,
video_height,
0,
1,
(selected ? ozone->theme->text_selected : ozone->theme->entries_icon));
value_idx = ozone_system_tabs_value[ozone->tabs[i]];
title = msg_hash_to_str(value_idx);
@ -296,9 +307,20 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
goto console_iterate;
/* Icon */
ozone_draw_icon(video_info, ozone->dimensions.sidebar_entry_icon_size, ozone->dimensions.sidebar_entry_icon_size,
node->icon, ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.sidebar_entry_icon_padding,
y + ozone->dimensions.sidebar_entry_height / 2 - ozone->dimensions.sidebar_entry_icon_size / 2 + ozone->animations.scroll_y_sidebar, video_width, video_height, 0, 1, (selected ? ozone->theme->text_selected : ozone->theme->entries_icon));
ozone_draw_icon(
userdata,
video_width,
video_height,
ozone->dimensions.sidebar_entry_icon_size,
ozone->dimensions.sidebar_entry_icon_size,
node->icon,
ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.sidebar_entry_icon_padding,
y + ozone->dimensions.sidebar_entry_height / 2 - ozone->dimensions.sidebar_entry_icon_size / 2 + ozone->animations.scroll_y_sidebar,
video_width,
video_height,
0,
1,
(selected ? ozone->theme->text_selected : ozone->theme->entries_icon));
/* Text */
if (ozone->sidebar_collapsed)