Notify the menu driver when the menu is going to be toggled, implement progressive menu fade in

This commit is contained in:
Jean-André Santoni 2015-01-26 23:45:16 +01:00
parent 5c08e9dea4
commit 22119d0e7f
8 changed files with 33 additions and 0 deletions

View File

@ -659,6 +659,7 @@ menu_ctx_driver_t menu_ctx_glui = {
NULL,
NULL,
NULL,
NULL,
glui_navigation_clear,
NULL,
NULL,

View File

@ -107,6 +107,7 @@ menu_ctx_driver_t menu_ctx_ios = {
NULL, // populate_entries
NULL, // iterate
NULL, // input_postprocess
NULL, // toggle
NULL, // navigation_clear
NULL, // navigation_decrement
NULL, // navigation_increment

View File

@ -1846,6 +1846,7 @@ menu_ctx_driver_t menu_ctx_lakka = {
NULL,
NULL,
NULL,
NULL,
lakka_init_core_info,
lakka_update_core_info,
lakka_entry_iterate,

View File

@ -656,6 +656,7 @@ menu_ctx_driver_t menu_ctx_rgui = {
rgui_populate_entries,
NULL,
NULL,
NULL,
rgui_navigation_clear,
NULL,
NULL,

View File

@ -380,6 +380,7 @@ menu_ctx_driver_t menu_ctx_rmenu = {
NULL,
NULL,
NULL,
NULL,
rmenu_update_core_info,
rmenu_entry_iterate,
"rmenu",

View File

@ -1163,6 +1163,7 @@ static void *xmb_init(void)
xmb->arrow_alpha = 0;
xmb->depth = 1;
xmb->old_depth = 1;
xmb->alpha = 0;
xmb->c_active_zoom = 1.0;
xmb->c_passive_zoom = 0.5;
@ -1563,6 +1564,25 @@ static void xmb_context_destroy(void *data)
}
}
static void xmb_toggle(bool menu_on)
{
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = (menu_handle_t*)driver.menu;
if (!menu)
return;
xmb = (xmb_handle_t*)menu->userdata;
if (!xmb)
return;
if (menu_on)
add_tween(XMB_DELAY, 1.0f, &xmb->alpha, &inOutQuad, NULL);
else
xmb->alpha = 0;
}
menu_ctx_driver_t menu_ctx_xmb = {
NULL,
xmb_get_message,
@ -1576,6 +1596,7 @@ menu_ctx_driver_t menu_ctx_xmb = {
xmb_populate_entries,
NULL,
NULL,
xmb_toggle,
xmb_navigation_clear,
xmb_navigation_decrement,
xmb_navigation_increment,

View File

@ -174,6 +174,7 @@ typedef struct menu_ctx_driver
unsigned);
void (*iterate)(void*, unsigned);
int (*input_postprocess)(uint64_t, uint64_t);
void (*toggle)(bool);
void (*navigation_clear)(void *, bool);
void (*navigation_decrement)(void *);
void (*navigation_increment)(void *);

View File

@ -2278,6 +2278,9 @@ void rarch_main_set_state(unsigned cmd)
if (!driver.menu)
return;
if (driver.menu && driver.menu_ctx && driver.menu_ctx->toggle)
driver.menu_ctx->toggle(true);
/* Menu should always run with vsync on. */
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
/* Stop all rumbling before entering the menu. */
@ -2310,6 +2313,9 @@ void rarch_main_set_state(unsigned cmd)
#ifdef HAVE_MENU
menu_apply_deferred_settings();
if (driver.menu && driver.menu_ctx && driver.menu_ctx->toggle)
driver.menu_ctx->toggle(false);
g_extern.is_menu = false;
driver_set_nonblock_state(driver.nonblock_state);