mirror of
https://github.com/libretro/RetroArch
synced 2025-04-15 23:42:30 +00:00
(XMB) Optional vertical list item fade (#13455)
This commit is contained in:
parent
483d1f2ac7
commit
b7d77e9484
@ -733,6 +733,7 @@ static const bool content_show_playlists = true;
|
||||
|
||||
#ifdef HAVE_XMB
|
||||
#define DEFAULT_XMB_ANIMATION 0
|
||||
#define DEFAULT_XMB_VERTICAL_FADE_FACTOR 100
|
||||
|
||||
static const unsigned xmb_alpha_factor = 75;
|
||||
static const unsigned menu_font_color_red = 255;
|
||||
|
@ -2196,6 +2196,7 @@ static struct config_uint_setting *populate_settings_uint(
|
||||
SETTING_UINT("menu_font_color_green", &settings->uints.menu_font_color_green, true, menu_font_color_green, false);
|
||||
SETTING_UINT("menu_font_color_blue", &settings->uints.menu_font_color_blue, true, menu_font_color_blue, false);
|
||||
SETTING_UINT("menu_xmb_thumbnail_scale_factor", &settings->uints.menu_xmb_thumbnail_scale_factor, true, xmb_thumbnail_scale_factor, false);
|
||||
SETTING_UINT("menu_xmb_vertical_fade_factor",&settings->uints.menu_xmb_vertical_fade_factor, true, DEFAULT_XMB_VERTICAL_FADE_FACTOR, false);
|
||||
#endif
|
||||
SETTING_UINT("materialui_menu_color_theme", &settings->uints.menu_materialui_color_theme, true, DEFAULT_MATERIALUI_THEME, false);
|
||||
SETTING_UINT("materialui_menu_transition_animation", &settings->uints.menu_materialui_transition_animation, true, DEFAULT_MATERIALUI_TRANSITION_ANIM, false);
|
||||
|
@ -278,6 +278,7 @@ typedef struct settings
|
||||
unsigned menu_xmb_theme;
|
||||
unsigned menu_xmb_color_theme;
|
||||
unsigned menu_xmb_thumbnail_scale_factor;
|
||||
unsigned menu_xmb_vertical_fade_factor;
|
||||
unsigned menu_materialui_color_theme;
|
||||
unsigned menu_materialui_transition_animation;
|
||||
unsigned menu_materialui_thumbnail_view_portrait;
|
||||
|
@ -3046,6 +3046,10 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_MENU_XMB_THUMBNAIL_SCALE_FACTOR,
|
||||
"menu_xmb_thumbnail_scale_factor"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_MENU_XMB_VERTICAL_FADE_FACTOR,
|
||||
"menu_xmb_vertical_fade_factor"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_MENU_THUMBNAIL_UPSCALE_THRESHOLD,
|
||||
"menu_thumbnail_upscale_threshold"
|
||||
|
@ -9156,6 +9156,10 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_XMB_THUMBNAIL_SCALE_FACTOR,
|
||||
"Reduce thumbnail display size by scaling maximum allowed width."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_XMB_VERTICAL_FADE_FACTOR,
|
||||
"Vertical Fade Factor"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
|
||||
"Enable Settings Tab (Restart Required)"
|
||||
|
@ -3183,6 +3183,8 @@ static int xmb_draw_item(
|
||||
bool menu_xmb_vertical_thumbnails = settings->bools.menu_xmb_vertical_thumbnails;
|
||||
bool menu_show_sublabels = settings->bools.menu_show_sublabels;
|
||||
unsigned show_history_icons = settings->uints.playlist_show_history_icons;
|
||||
unsigned menu_xmb_vertical_fade_factor
|
||||
= settings->uints.menu_xmb_vertical_fade_factor;
|
||||
|
||||
/* Initial ticker configuration */
|
||||
if (use_smooth_ticker)
|
||||
@ -3362,6 +3364,34 @@ static int xmb_draw_item(
|
||||
|
||||
label_offset = xmb->margins_label_top;
|
||||
|
||||
if (menu_xmb_vertical_fade_factor)
|
||||
{
|
||||
float factor = menu_xmb_vertical_fade_factor / 100.0f / 0.004f;
|
||||
float min_alpha = 0.1f;
|
||||
float max_alpha = (i == current) ? xmb->items_active_alpha : xmb->items_passive_alpha;
|
||||
float new_alpha = node->alpha;
|
||||
float top_margin = xmb->margins_screen_top;
|
||||
float icon_space = xmb->icon_spacing_vertical;
|
||||
|
||||
/* Top */
|
||||
if (node->y < 0)
|
||||
new_alpha = (node->y + top_margin + (icon_space / 4)) / factor;
|
||||
/* Bottom */
|
||||
else if (node->y > (height - (top_margin * 2)) && node->y < (height - top_margin + icon_space))
|
||||
new_alpha = (height - node->y - top_margin + (icon_space / 4)) / factor;
|
||||
/* Rest need to reset after vertical wrap-around */
|
||||
else if (node->x == 0 && node->alpha > 0 && node->alpha != max_alpha)
|
||||
new_alpha = max_alpha;
|
||||
|
||||
/* Limits */
|
||||
new_alpha = (new_alpha < min_alpha) ? min_alpha : new_alpha;
|
||||
new_alpha = (new_alpha > max_alpha) ? max_alpha : new_alpha;
|
||||
|
||||
/* Horizontal animation requires breathing room on x-axis */
|
||||
if (new_alpha != node->alpha && node->x > (-icon_space * 2) && node->x < (icon_space * 2))
|
||||
node->alpha = node->label_alpha = new_alpha;
|
||||
}
|
||||
|
||||
if (menu_show_sublabels)
|
||||
{
|
||||
if (i == current && width > 320 && height > 240
|
||||
@ -4878,6 +4908,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
bool menu_core_enable = settings->bools.menu_core_enable;
|
||||
float thumbnail_scale_factor = (float)settings->uints.menu_xmb_thumbnail_scale_factor / 100.0f;
|
||||
bool menu_xmb_vertical_thumbnails = settings->bools.menu_xmb_vertical_thumbnails;
|
||||
unsigned menu_xmb_vertical_fade_factor = settings->uints.menu_xmb_vertical_fade_factor;
|
||||
void *userdata = video_info->userdata;
|
||||
unsigned video_width = video_info->width;
|
||||
unsigned video_height = video_info->height;
|
||||
@ -4975,7 +5006,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
strlcpy(title_truncated,
|
||||
xmb->title_name, sizeof(title_truncated));
|
||||
|
||||
if (selection > 1)
|
||||
if (!menu_xmb_vertical_fade_factor && selection > 1)
|
||||
{
|
||||
/* skip 25 UTF8 multi-byte chars */
|
||||
char *end = title_truncated;
|
||||
|
@ -9447,6 +9447,7 @@ unsigned menu_displaylist_build_list(
|
||||
{MENU_ENUM_LABEL_MENU_RGUI_PARTICLE_EFFECT, PARSE_ONLY_UINT, true},
|
||||
{MENU_ENUM_LABEL_MENU_RGUI_PARTICLE_EFFECT_SPEED, PARSE_ONLY_FLOAT, false},
|
||||
{MENU_ENUM_LABEL_MENU_RGUI_PARTICLE_EFFECT_SCREENSAVER, PARSE_ONLY_BOOL, false},
|
||||
{MENU_ENUM_LABEL_MENU_XMB_VERTICAL_FADE_FACTOR, PARSE_ONLY_UINT, true},
|
||||
{MENU_ENUM_LABEL_XMB_ALPHA_FACTOR, PARSE_ONLY_UINT, true},
|
||||
{MENU_ENUM_LABEL_XMB_FONT, PARSE_ONLY_PATH, true},
|
||||
{MENU_ENUM_LABEL_MENU_FONT_COLOR_RED, PARSE_ONLY_UINT, true},
|
||||
|
@ -16018,6 +16018,23 @@ static bool setting_append_list(
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 100, 1, true, true);
|
||||
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.menu_xmb_vertical_fade_factor,
|
||||
MENU_ENUM_LABEL_MENU_XMB_VERTICAL_FADE_FACTOR,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_XMB_VERTICAL_FADE_FACTOR,
|
||||
DEFAULT_XMB_VERTICAL_FADE_FACTOR,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_with_refresh;
|
||||
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_with_refresh;
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 300, 1, true, true);
|
||||
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||
|
||||
CONFIG_PATH(
|
||||
list, list_info,
|
||||
settings->paths.path_menu_xmb_font,
|
||||
|
@ -1229,6 +1229,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(LEFT_THUMBNAILS_MATERIALUI),
|
||||
MENU_LABEL(XMB_VERTICAL_THUMBNAILS),
|
||||
MENU_LABEL(MENU_XMB_THUMBNAIL_SCALE_FACTOR),
|
||||
MENU_LABEL(MENU_XMB_VERTICAL_FADE_FACTOR),
|
||||
MENU_LABEL(MENU_THUMBNAIL_UPSCALE_THRESHOLD),
|
||||
MENU_LABEL(MENU_RGUI_INLINE_THUMBNAILS),
|
||||
MENU_LABEL(MENU_RGUI_SWAP_THUMBNAILS),
|
||||
|
Loading…
x
Reference in New Issue
Block a user