(Menu) Cleanups

This commit is contained in:
twinaphex 2015-06-15 17:34:12 +02:00
parent 9b8248d3d2
commit 0c4ac61b38
8 changed files with 58 additions and 48 deletions

View File

@ -239,8 +239,8 @@ static void glui_render(void)
glui = (glui_handle_t*)menu->userdata;
menu_animation_update(menu->animation,
menu->animation->delta_time / IDEAL_DT);
menu_animation_update(disp->animation,
disp->animation->delta_time / IDEAL_DT);
/* TODO/FIXME - we don't use framebuffer at all
* for GLUI, we should refactor this dependency
@ -635,12 +635,13 @@ static float glui_get_scroll(void)
static void glui_navigation_set(bool scroll)
{
menu_display_t *disp = menu_display_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu || !scroll)
if (!menu || !disp || !scroll)
return;
menu_animation_push(menu->animation, 10, glui_get_scroll(),
menu_animation_push(disp->animation, 10, glui_get_scroll(),
&menu->scroll_y, EASING_IN_OUT_QUAD, NULL);
}

View File

@ -513,6 +513,7 @@ static void xmb_selection_pointer_changed(void)
unsigned i, current, end;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
@ -546,13 +547,13 @@ static void xmb_selection_pointer_changed(void)
iz = xmb->item.active.zoom;
}
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, iz, &node->zoom, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, iy, &node->y, EASING_IN_OUT_QUAD, NULL);
}
}
@ -561,10 +562,10 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
file_list_t *list, int dir, size_t current)
{
unsigned i;
size_t end = 0;
menu_handle_t *menu = menu_driver_get_ptr();
size_t end = 0;
menu_display_t *disp = menu_display_get_ptr();
if (!menu)
if (!disp)
return;
end = file_list_get_size(list);
@ -582,11 +583,11 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
if (dir == -1)
ia = 0;
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, 0, &node->label_alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, xmb->icon.size * dir * -2, &node->x,
EASING_IN_OUT_QUAD, NULL);
}
@ -596,8 +597,9 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
file_list_t *list, int dir, size_t current)
{
unsigned i;
size_t end = 0;
menu_handle_t *menu = menu_driver_get_ptr();
size_t end = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
if (!menu)
return;
@ -630,11 +632,11 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
if (i == current)
ia = xmb->item.active.alpha;
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, 0, &node->x, EASING_IN_OUT_QUAD, NULL);
}
@ -674,15 +676,15 @@ static xmb_node_t* xmb_get_userdata_from_horizontal_list(
static void xmb_push_animations(xmb_node_t *node, float ia, float ix)
{
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
menu_display_t *disp = menu_display_get_ptr();
if (!disp)
return;
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, ix, &node->x, EASING_IN_OUT_QUAD, NULL);
}
@ -810,9 +812,9 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb, menu_handle_t *me
iz = xmb->categories.active.zoom;
}
menu_animation_push(menu->animation,
menu_animation_push(menu->display.animation,
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(menu->display.animation,
XMB_DELAY, iz, &node->zoom, EASING_IN_OUT_QUAD, NULL);
}
}
@ -821,6 +823,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
{
int dir = -1;
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
@ -834,7 +837,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
xmb_list_switch_horizontal_list(xmb, menu);
menu_animation_push(menu->animation, XMB_DELAY,
menu_animation_push(disp->animation, XMB_DELAY,
xmb->icon.spacing.horizontal * -(float)menu->categories.selection_ptr,
&xmb->categories.x_pos, EASING_IN_OUT_QUAD, NULL);
@ -870,7 +873,7 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu
else if (xmb->depth <= 1)
ia = xmb->categories.passive.alpha;
menu_animation_push(menu->animation, XMB_DELAY, ia,
menu_animation_push(menu->display.animation, XMB_DELAY, ia,
&node->alpha, EASING_IN_OUT_QUAD, NULL);
}
}
@ -879,6 +882,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
{
int dir = 0;
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
@ -902,18 +906,18 @@ static void xmb_list_open(xmb_handle_t *xmb)
switch (xmb->depth)
{
case 1:
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, xmb->icon.size * -(xmb->depth*2-2),
&xmb->x, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, 0, &xmb->textures.arrow.alpha,
EASING_IN_OUT_QUAD, NULL);
break;
case 2:
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, xmb->icon.size * -(xmb->depth*2-2),
&xmb->x, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation,
menu_animation_push(disp->animation,
XMB_DELAY, 1, &xmb->textures.arrow.alpha,
EASING_IN_OUT_QUAD, NULL);
break;
@ -1228,6 +1232,7 @@ static void xmb_render(void)
xmb_handle_t *xmb = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_animation_t *anim = menu_animation_get_ptr();
menu_input_t *menu_input = menu_input_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
@ -1241,7 +1246,7 @@ static void xmb_render(void)
if (!xmb)
return;
menu_animation_update(menu->animation, menu->animation->delta_time / IDEAL_DT);
menu_animation_update(disp->animation, disp->animation->delta_time / IDEAL_DT);
current = nav->selection_ptr;
end = menu_list_get_size(menu_list);
@ -2099,8 +2104,9 @@ static void xmb_toggle_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu)
static void xmb_toggle(bool menu_on)
{
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
if (!menu)
return;
@ -2118,7 +2124,7 @@ static void xmb_toggle(bool menu_on)
return;
}
menu_animation_push(menu->animation, XMB_DELAY, 1.0f,
menu_animation_push(disp->animation, XMB_DELAY, 1.0f,
&xmb->alpha, EASING_IN_OUT_QUAD, NULL);
xmb->prevent_populate = !menu_needs_refresh();

View File

@ -296,10 +296,10 @@ int menu_iterate(retro_input_t input,
int32_t ret = 0;
unsigned action = 0;
runloop_t *runloop = rarch_main_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_input_t *menu_input = menu_input_get_ptr();
menu_animation_update_time(menu->animation);
menu_animation_update_time(disp->animation);
menu_input->joypad.state = menu_input_frame(input, trigger_input);

View File

@ -19,6 +19,7 @@
#include <compat/strl.h>
#include <retro_miscellaneous.h>
#include "menu_display.h"
#include "menu_animation.h"
#include "../configuration.h"
#include "../runloop.h"
@ -26,10 +27,10 @@
menu_animation_t *menu_animation_get_ptr(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
menu_display_t *disp = menu_display_get_ptr();
if (!disp)
return NULL;
return menu->animation;
return disp->animation;
}
/* from https://github.com/kikito/tween.lua/blob/master/tween.lua */

View File

@ -118,15 +118,15 @@ void menu_display_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
menu_display_t *disp = menu ? &menu->display : NULL;
if (!menu || !disp)
if (!disp)
return;
if (disp->msg_queue)
msg_queue_free(disp->msg_queue);
disp->msg_queue = NULL;
menu_animation_free(menu->animation);
menu->animation = NULL;
menu_animation_free(disp->animation);
disp->animation = NULL;
menu_display_fb_free(&disp->frame_buf);
}
@ -137,10 +137,10 @@ bool menu_display_init(void *data)
if (!menu)
return false;
menu->animation = (menu_animation_t*)calloc
menu->display.animation = (menu_animation_t*)calloc
(1, sizeof(menu_animation_t));
if (!menu->animation)
if (!menu->display.animation)
return false;
return true;

View File

@ -22,6 +22,7 @@
#include <queues/message_queue.h>
#include "menu_animation.h"
#include "../gfx/font_renderer_driver.h"
#ifdef __cplusplus
@ -42,6 +43,7 @@ typedef struct menu_display
bool msg_force;
menu_framebuf_t frame_buf;
menu_animation_t *animation;
struct
{

View File

@ -77,7 +77,6 @@ typedef struct
menu_input_t input;
rarch_setting_t *list_settings;
menu_animation_t *animation;
content_playlist_t *playlist;
char db_playlist_file[PATH_MAX_LENGTH];

View File

@ -995,6 +995,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
| (1ULL << RETRO_DEVICE_ID_JOYPAD_R);
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_input_t *menu_input = menu_input_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
@ -1033,7 +1034,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
nav->scroll.acceleration = 0;
}
menu_input->delay.count += menu->animation->delta_time / IDEAL_DT;
menu_input->delay.count += disp->animation->delta_time / IDEAL_DT;
if (driver->block_input)
trigger_input = 0;