Ozone: Add a touch-sensitive "resume" button in the lower-right corner. (#17192)
Some checks are pending
CI 3DS / build (push) Waiting to run
CI Android / build (push) Waiting to run
CI DOS/DJGPP / build (push) Waiting to run
CI Emscripten / build (push) Waiting to run
CI GameCube / build (push) Waiting to run
CI Linux (i686) / build (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, UWP) (push) Waiting to run
CI Windows (MSVC) / msvc (ReleaseAngle, x64, UWP) (push) Waiting to run
CI macOS / build (push) Waiting to run
CI Miyoo ARM32 / build (push) Waiting to run
CI PS2 / build (push) Waiting to run
CI PS4/ORBIS / build (push) Waiting to run
CI PSP / build (push) Waiting to run
CI PSVita / build (push) Waiting to run
CI RS90 Odbeta MIPS32 / build (push) Waiting to run
CI RetroFW MIPS32 / build (push) Waiting to run
CI Switch/libnx / build (push) Waiting to run
CI Wii / build (push) Waiting to run
CI WiiU / build (push) Waiting to run
CI Windows i686 (MXE) / build (push) Waiting to run
CI Windows x64 (MXE) / build (push) Waiting to run
RetroArch CI / linux-c89 (push) Waiting to run
CI webOS / build (push) Waiting to run

This enhancement is particularly useful when using RetroArch with a touchscreen, as it allows you to resume content without needing to navigate back to the quick menu, thereby preserving the current menu screen.
This commit is contained in:
Antonio Orefice 2024-11-20 19:56:35 +01:00 committed by GitHub
parent aff99e3e10
commit b0db968454
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 66 additions and 5 deletions

View File

@ -490,6 +490,7 @@ struct ozone_handle
ozone_footer_label_t help;
ozone_footer_label_t clear;
ozone_footer_label_t scan;
ozone_footer_label_t resume;
} footer_labels;
struct
@ -9117,6 +9118,12 @@ static void ozone_cache_footer_label(
* menu language) and calculates pixel widths */
static void ozone_cache_footer_labels(ozone_handle_t *ozone)
{
/* Just the resume icon or text too?
* The former seems better to me. */
/* ozone_cache_footer_label(ozone,
&ozone->footer_labels.resume,
MENU_ENUM_SUBLABEL_RESUME_CONTENT);*/
ozone_cache_footer_label(ozone,
&ozone->footer_labels.ok,
MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK);
@ -10722,9 +10729,13 @@ static void ozone_draw_footer(
bool manage_available =
ozone_manage_available(ozone, selection);
bool resume_enabled =
!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL);
/* Determine x origin positions of each
* button
* > From right to left, these are ordered:
* - resume
* - ok
* - back
* - (X) search
@ -10735,9 +10746,14 @@ static void ozone_draw_footer(
* - (Start) reset to default (settings only)
* - (Start) manage playlist (sidebar only)
* - (Select) toggle metadata (playlists only)
* - (Select) help (non-playlist only) */
float ok_x = (float)video_width
- footer_margin - ozone->footer_labels.ok.width - icon_size - icon_padding;
* - (Select) help (non-playlist only)*/
float resume_x = (resume_enabled)
? (float)video_width - footer_margin - ozone->footer_labels.resume.width - icon_size - icon_padding
: (float)video_width - footer_margin;
float ok_x = resume_x
- ozone->footer_labels.ok.width - icon_size - (2.0f * icon_padding);
float back_x = ok_x
- ozone->footer_labels.back.width - icon_size - (2.0f * icon_padding);
float search_x = (search_enabled)
@ -10795,6 +10811,25 @@ static void ozone_draw_footer(
if (dispctx->draw)
{
/* > Resume */
if (resume_enabled)
ozone_draw_icon(
p_disp,
userdata,
video_width,
video_height,
icon_size,
icon_size,
ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RESUME],
resume_x,
icon_y,
video_width,
video_height,
0.0f,
1.0f,
col,
mymat);
/* > Ok */
ozone_draw_icon(
p_disp,
@ -11110,6 +11145,21 @@ static void ozone_draw_footer(
1.0f,
false);
/* > Resume */
gfx_display_draw_text(
ozone->fonts.footer.font,
ozone->footer_labels.resume.str,
resume_x + icon_size + icon_padding_small,
footer_text_y,
video_width,
video_height,
ozone->theme->text_rgba,
TEXT_ALIGN_LEFT,
1.0f,
false,
1.0f,
false);
/* > Reset to default */
if (reset_to_default_available)
gfx_display_draw_text(
@ -12489,9 +12539,14 @@ static int ozone_tap_footer(
&& ozone_help_available(ozone, selection, settings->bools.menu_show_sublabels);
bool manage_available =
ozone_manage_available(ozone, selection);
bool resume_enabled =
!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL);
float ok_x = (float)video_width
- footer_margin - ozone->footer_labels.ok.width - icon_size - icon_padding;
float resume_x = (resume_enabled)
? (float)video_width - footer_margin - ozone->footer_labels.resume.width - icon_size - icon_padding
: (float)video_width - footer_margin;
float ok_x = resume_x
- ozone->footer_labels.ok.width - icon_size - (2.0f * icon_padding);
float back_x = ok_x
- ozone->footer_labels.back.width - icon_size - (2.0f * icon_padding);
float search_x = (search_enabled)
@ -12523,6 +12578,8 @@ static int ozone_tap_footer(
if (x > (float)video_width - footer_margin)
return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_CANCEL);
else if (resume_enabled && x > resume_x)
return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_RESUME);
else if (x > ok_x)
return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_OK);
else if (x > back_x)

View File

@ -457,6 +457,7 @@ enum menu_action
MENU_ACTION_SCROLL_HOME,
MENU_ACTION_SCROLL_END,
MENU_ACTION_TOGGLE,
MENU_ACTION_RESUME,
MENU_ACTION_POINTER_MOVED,
MENU_ACTION_POINTER_PRESSED,
MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE,

View File

@ -7714,6 +7714,9 @@ int generic_menu_entry_action(
ret = cbs->action_scan(entry->path,
entry->label, entry->type, i);
break;
case MENU_ACTION_RESUME:
command_event(CMD_EVENT_MENU_TOGGLE, NULL);
break;
default:
break;
}