mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(XMB) Layout and thumbnail fixes (#16156)
* (XMB) Thumbnail layout adjustments * (XMB) Header title improvements * (XMB) Handheld layout adjustments
This commit is contained in:
parent
c1130b8775
commit
07e945b5ae
@ -5641,6 +5641,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
gfx_thumbnail_shadow_t thumbnail_shadow;
|
||||
size_t selection = 0;
|
||||
size_t percent_width = 0;
|
||||
size_t title_header_max_width = 0;
|
||||
bool render_background = false;
|
||||
file_list_t *selection_buf = NULL;
|
||||
const float under_thumb_margin = 0.96f;
|
||||
@ -5754,43 +5755,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
selection = menu_st->selection_ptr;
|
||||
|
||||
/* Use alternative title if available */
|
||||
strlcpy(title_truncated,
|
||||
!string_is_empty(xmb->title_name_alt) ? xmb->title_name_alt : xmb->title_name,
|
||||
sizeof(title_truncated));
|
||||
|
||||
if (!vertical_fade_factor && selection > 1)
|
||||
{
|
||||
/* skip 25 UTF8 multi-byte chars */
|
||||
char *end = title_truncated;
|
||||
|
||||
for (i = 0; i < 25 && *end; i++)
|
||||
{
|
||||
end++;
|
||||
while ((*end & 0xC0) == 0x80)
|
||||
end++;
|
||||
}
|
||||
|
||||
*end = '\0';
|
||||
}
|
||||
|
||||
/* Title text */
|
||||
if (show_title_header)
|
||||
xmb_draw_text(shadows_enable, xmb, settings,
|
||||
title_truncated, xmb->margins_title_left,
|
||||
xmb->margins_title_top,
|
||||
1, 1, TEXT_ALIGN_LEFT,
|
||||
video_width, video_height, xmb->font);
|
||||
|
||||
if (menu_core_enable)
|
||||
{
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
xmb_draw_text(shadows_enable, xmb, settings,
|
||||
title_msg, xmb->margins_title_left,
|
||||
video_height - xmb->margins_title_bottom, 1, 1, TEXT_ALIGN_LEFT,
|
||||
video_width, video_height, xmb->font);
|
||||
}
|
||||
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */
|
||||
@ -5798,6 +5762,62 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata);
|
||||
}
|
||||
|
||||
/* Arrow image */
|
||||
gfx_display_set_alpha(xmb_item_color, MIN(xmb->textures_arrow_alpha, xmb->alpha));
|
||||
|
||||
if (!xmb->assets_missing)
|
||||
{
|
||||
if (dispctx && dispctx->blend_begin)
|
||||
dispctx->blend_begin(userdata);
|
||||
|
||||
xmb_draw_icon(
|
||||
userdata,
|
||||
p_disp,
|
||||
dispctx,
|
||||
video_width,
|
||||
video_height,
|
||||
shadows_enable,
|
||||
xmb->icon_size,
|
||||
xmb->textures.list[XMB_TEXTURE_ARROW],
|
||||
xmb->x + xmb->margins_screen_left +
|
||||
xmb->icon_spacing_horizontal -
|
||||
xmb->icon_size / 2.0 + xmb->icon_size,
|
||||
xmb->margins_screen_top +
|
||||
xmb->icon_size / 2.0 + xmb->icon_spacing_vertical
|
||||
* xmb->active_item_factor,
|
||||
video_width,
|
||||
video_height,
|
||||
xmb->textures_arrow_alpha,
|
||||
0,
|
||||
1,
|
||||
&xmb_item_color[0],
|
||||
xmb->shadow_offset,
|
||||
&mymat);
|
||||
|
||||
/* Previous icon */
|
||||
xmb_draw_items(
|
||||
userdata,
|
||||
p_disp,
|
||||
dispctx,
|
||||
p_anim,
|
||||
menu_st,
|
||||
settings,
|
||||
video_width,
|
||||
video_height,
|
||||
shadows_enable,
|
||||
xmb,
|
||||
&xmb->selection_buf_old,
|
||||
xmb->selection_ptr_old,
|
||||
xmb->categories_selection_ptr,
|
||||
&xmb_item_color[0],
|
||||
video_width,
|
||||
video_height,
|
||||
&mymat);
|
||||
|
||||
if (dispctx && dispctx->blend_end)
|
||||
dispctx->blend_end(userdata);
|
||||
}
|
||||
|
||||
/**************************/
|
||||
/* Draw thumbnails: START */
|
||||
/**************************/
|
||||
@ -5834,22 +5854,24 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
|| (xmb->thumbnails.savestate.status == GFX_THUMBNAIL_STATUS_PENDING)))
|
||||
{
|
||||
float thumb_width = right_thumbnail_margin_width;
|
||||
float thumb_height = thumbnail_margin_height_full;
|
||||
float thumb_height = thumb_width - (thumb_width / 4);
|
||||
float scaled_thumb_width = thumb_width * thumbnail_scale_factor;
|
||||
float scaled_thumb_height = thumb_height * thumbnail_scale_factor;
|
||||
float thumb_x = right_thumbnail_margin_x + ((thumb_width - scaled_thumb_width) / 2.0f);
|
||||
float thumb_y = xmb->margins_title_top + (xmb->icon_size / 4.0f) + ((thumb_height - scaled_thumb_height) / 2.0f);
|
||||
float thumb_y = (video_height - thumb_height) / 2.0f;
|
||||
|
||||
/* Make sure thumbnail stays visible with extra wide screens */
|
||||
if (thumb_height > video_height)
|
||||
thumb_y -= (thumb_height - video_height) / 2.0f;
|
||||
|
||||
if (!xmb->use_ps3_layout)
|
||||
{
|
||||
float y_offset = ((xmb->depth != 1) ? 1.2f : -0.25f) * xmb->icon_size;
|
||||
|
||||
thumb_width = xmb->icon_size * 2.4f;
|
||||
thumb_height = thumbnail_margin_height_under - xmb->margins_title_bottom - (xmb->icon_size / 6.0f) - y_offset;
|
||||
thumb_height = thumb_width - (thumb_width / 4);
|
||||
scaled_thumb_width = thumb_width * thumbnail_scale_factor;
|
||||
scaled_thumb_height = thumb_height * thumbnail_scale_factor;
|
||||
thumb_x = (thumb_width - scaled_thumb_width) / 2.0f;
|
||||
thumb_y = xmb->margins_screen_top + xmb->icon_size + y_offset;
|
||||
thumb_y = video_height - thumbnail_margin_height_under - (xmb->icon_size * 0.55f);
|
||||
}
|
||||
|
||||
gfx_thumbnail_draw(
|
||||
@ -6003,13 +6025,12 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
* (if available) */
|
||||
else if (show_right_thumbnail || show_left_thumbnail)
|
||||
{
|
||||
float y_offset = ((xmb->depth != 1) ? 1.2f : -0.25f) * xmb->icon_size;
|
||||
float thumb_width = xmb->icon_size * 2.4f;
|
||||
float thumb_height = thumbnail_margin_height_under - xmb->margins_title_bottom - (xmb->icon_size / 6.0f) - y_offset;
|
||||
float thumb_height = thumbnail_margin_height_under - xmb->margins_title_bottom;
|
||||
float scaled_thumb_width = thumb_width * thumbnail_scale_factor;
|
||||
float scaled_thumb_height = thumb_height * thumbnail_scale_factor;
|
||||
float thumb_x = (thumb_width - scaled_thumb_width) / 2.0f;
|
||||
float thumb_y = xmb->margins_screen_top + xmb->icon_size + y_offset;
|
||||
float thumb_y = video_height - thumbnail_margin_height_under - (xmb->icon_size * 0.55f);
|
||||
|
||||
/* Very small thumbnails look ridiculous
|
||||
* > Impose a minimum size limit */
|
||||
@ -6049,7 +6070,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
if (powerstate.battery_enabled)
|
||||
{
|
||||
size_t x_pos = xmb->icon_size / 6;
|
||||
size_t x_pos = xmb->icon_size / 5;
|
||||
|
||||
if (!xmb->assets_missing)
|
||||
{
|
||||
@ -6091,6 +6112,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
font_driver_get_message_width(
|
||||
xmb->font, msg, strlen(msg), 1.0f);
|
||||
|
||||
title_header_max_width = x_pos;
|
||||
|
||||
xmb_draw_text(shadows_enable, xmb, settings, msg,
|
||||
video_width - xmb->margins_title_left - x_pos,
|
||||
xmb->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT,
|
||||
@ -6102,10 +6125,10 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
gfx_display_ctx_datetime_t datetime;
|
||||
char timedate[255];
|
||||
size_t x_pos = 2;
|
||||
size_t x_pos = 0;
|
||||
|
||||
if (percent_width)
|
||||
x_pos = percent_width + (xmb->icon_size / 2.5);
|
||||
x_pos += percent_width + (xmb->icon_size / 2);
|
||||
|
||||
if (!xmb->assets_missing)
|
||||
{
|
||||
@ -6145,46 +6168,15 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
menu_display_timedate(&datetime);
|
||||
|
||||
title_header_max_width = x_pos + font_driver_get_message_width(
|
||||
xmb->font, timedate, strlen(timedate), 1.0f);
|
||||
|
||||
xmb_draw_text(shadows_enable, xmb, settings, timedate,
|
||||
video_width - xmb->margins_title_left - xmb->icon_size / 4 - x_pos,
|
||||
xmb->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT,
|
||||
video_width, video_height, xmb->font);
|
||||
}
|
||||
|
||||
/* Arrow image */
|
||||
gfx_display_set_alpha(xmb_item_color, MIN(xmb->textures_arrow_alpha, xmb->alpha));
|
||||
|
||||
if (!xmb->assets_missing)
|
||||
{
|
||||
if (dispctx && dispctx->blend_begin)
|
||||
dispctx->blend_begin(userdata);
|
||||
xmb_draw_icon(
|
||||
userdata,
|
||||
p_disp,
|
||||
dispctx,
|
||||
video_width,
|
||||
video_height,
|
||||
shadows_enable,
|
||||
xmb->icon_size,
|
||||
xmb->textures.list[XMB_TEXTURE_ARROW],
|
||||
xmb->x + xmb->margins_screen_left +
|
||||
xmb->icon_spacing_horizontal -
|
||||
xmb->icon_size / 2.0 + xmb->icon_size,
|
||||
xmb->margins_screen_top +
|
||||
xmb->icon_size / 2.0 + xmb->icon_spacing_vertical
|
||||
* xmb->active_item_factor,
|
||||
video_width,
|
||||
video_height,
|
||||
xmb->textures_arrow_alpha,
|
||||
0,
|
||||
1,
|
||||
&xmb_item_color[0],
|
||||
xmb->shadow_offset,
|
||||
&mymat);
|
||||
if (dispctx && dispctx->blend_end)
|
||||
dispctx->blend_end(userdata);
|
||||
}
|
||||
|
||||
if (dispctx && dispctx->blend_begin)
|
||||
dispctx->blend_begin(userdata);
|
||||
|
||||
@ -6279,26 +6271,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
}
|
||||
}
|
||||
|
||||
/* Previous icon */
|
||||
xmb_draw_items(
|
||||
userdata,
|
||||
p_disp,
|
||||
dispctx,
|
||||
p_anim,
|
||||
menu_st,
|
||||
settings,
|
||||
video_width,
|
||||
video_height,
|
||||
shadows_enable,
|
||||
xmb,
|
||||
&xmb->selection_buf_old,
|
||||
xmb->selection_ptr_old,
|
||||
xmb->categories_selection_ptr,
|
||||
&xmb_item_color[0],
|
||||
video_width,
|
||||
video_height,
|
||||
&mymat);
|
||||
|
||||
selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
|
||||
|
||||
/* List icons */
|
||||
@ -6324,6 +6296,95 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
if (dispctx && dispctx->blend_end)
|
||||
dispctx->blend_end(userdata);
|
||||
|
||||
/* Use alternative title if available */
|
||||
strlcpy(title_truncated,
|
||||
!string_is_empty(xmb->title_name_alt) ? xmb->title_name_alt : xmb->title_name,
|
||||
sizeof(title_truncated));
|
||||
|
||||
if (!vertical_fade_factor && selection > 1)
|
||||
{
|
||||
/* skip 25 UTF8 multi-byte chars */
|
||||
char *end = title_truncated;
|
||||
|
||||
for (i = 0; i < 25 && *end; i++)
|
||||
{
|
||||
end++;
|
||||
while ((*end & 0xC0) == 0x80)
|
||||
end++;
|
||||
}
|
||||
|
||||
*end = '\0';
|
||||
}
|
||||
|
||||
/* Title text */
|
||||
if (show_title_header)
|
||||
{
|
||||
gfx_animation_ctx_ticker_t ticker;
|
||||
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
|
||||
char tmp[255];
|
||||
size_t tmp_len = (video_width - xmb->margins_title_left - xmb->icon_size - title_header_max_width);
|
||||
unsigned ticker_x_offset = 0;
|
||||
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
enum gfx_animation_ticker_type menu_ticker_type
|
||||
= (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
|
||||
tmp[0] = '\0';
|
||||
|
||||
/* Initial ticker configuration */
|
||||
if (use_smooth_ticker)
|
||||
{
|
||||
ticker_smooth.idx = p_anim->ticker_pixel_idx;
|
||||
ticker_smooth.font = xmb->font;
|
||||
ticker_smooth.font_scale = 1.0f;
|
||||
ticker_smooth.type_enum = menu_ticker_type;
|
||||
ticker_smooth.spacer = NULL;
|
||||
ticker_smooth.x_offset = &ticker_x_offset;
|
||||
ticker_smooth.dst_str_width = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ticker.idx = p_anim->ticker_idx;
|
||||
ticker.type_enum = menu_ticker_type;
|
||||
ticker.spacer = NULL;
|
||||
}
|
||||
|
||||
if (use_smooth_ticker)
|
||||
{
|
||||
ticker_smooth.field_width = tmp_len;
|
||||
ticker_smooth.src_str = title_truncated;
|
||||
ticker_smooth.dst_str = tmp;
|
||||
ticker_smooth.dst_str_len = sizeof(tmp);
|
||||
|
||||
if (ticker_smooth.src_str)
|
||||
gfx_animation_ticker_smooth(&ticker_smooth);
|
||||
}
|
||||
else
|
||||
{
|
||||
ticker.s = tmp;
|
||||
ticker.len = (tmp_len * xmb->last_scale_factor) / (xmb->font_size * 0.5f * xmb->last_scale_factor);
|
||||
ticker.str = title_truncated;
|
||||
|
||||
if (ticker.str)
|
||||
gfx_animation_ticker(&ticker);
|
||||
}
|
||||
|
||||
xmb_draw_text(shadows_enable, xmb, settings,
|
||||
tmp, (float)ticker_x_offset + xmb->margins_title_left,
|
||||
xmb->margins_title_top,
|
||||
1, 1, TEXT_ALIGN_LEFT,
|
||||
video_width, video_height, xmb->font);
|
||||
}
|
||||
|
||||
if (menu_core_enable)
|
||||
{
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
xmb_draw_text(shadows_enable, xmb, settings,
|
||||
title_msg, xmb->margins_title_left,
|
||||
video_height - xmb->margins_title_bottom,
|
||||
1, 1, TEXT_ALIGN_LEFT,
|
||||
video_width, video_height, xmb->font);
|
||||
}
|
||||
|
||||
if (xmb->font && xmb->font->renderer && xmb->font->renderer->flush)
|
||||
xmb->font->renderer->flush(video_width, video_height, xmb->font->renderer_data);
|
||||
if (xmb->font2 && xmb->font2->renderer && xmb->font2->renderer->flush)
|
||||
@ -6463,7 +6524,7 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
|
||||
float scale_factor = xmb->last_scale_factor;
|
||||
float margins_title = xmb->margins_title;
|
||||
float margins_title_h_offset = xmb->margins_title_horizontal_offset;
|
||||
unsigned new_font_size = 24.0 * scale_factor;
|
||||
unsigned new_font_size = 26.0 * scale_factor;
|
||||
|
||||
xmb->above_subitem_offset = 1.5;
|
||||
xmb->above_item_offset = -1.0;
|
||||
@ -6471,9 +6532,9 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
|
||||
xmb->under_item_offset = 3.0;
|
||||
|
||||
xmb->categories_active_zoom = 1.0;
|
||||
xmb->categories_passive_zoom = 1.0;
|
||||
xmb->categories_passive_zoom = 0.5;
|
||||
xmb->items_active_zoom = 1.0;
|
||||
xmb->items_passive_zoom = 1.0;
|
||||
xmb->items_passive_zoom = 0.5;
|
||||
|
||||
xmb->categories_active_alpha = 1.0;
|
||||
xmb->categories_passive_alpha = 0.85;
|
||||
@ -6487,7 +6548,7 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
|
||||
xmb->shadow_offset = 2.0;
|
||||
|
||||
xmb->font_size = new_font_size;
|
||||
xmb->font2_size = 22.0 * scale_factor;
|
||||
xmb->font2_size = 18.0 * scale_factor;
|
||||
|
||||
/* Limit minimum font size */
|
||||
xmb->font_size = (xmb->font_size < 7) ? 7 : xmb->font_size;
|
||||
@ -6496,7 +6557,7 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
|
||||
xmb->cursor_size = 64.0 * scale_factor;
|
||||
xmb->icon_size = 128.0 * scale_factor;
|
||||
xmb->icon_spacing_horizontal = 250.0 * scale_factor;
|
||||
xmb->icon_spacing_vertical = 96.0 * scale_factor;
|
||||
xmb->icon_spacing_vertical = 82.0 * scale_factor;
|
||||
|
||||
xmb->margins_screen_top = (256 + 16) * scale_factor;
|
||||
xmb->margins_screen_left = 136.0 * scale_factor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user