Remove menu_animation_get_delta_time
This commit is contained in:
parent
824e6618b2
commit
6d6117d5d6
|
@ -208,6 +208,7 @@ end:
|
||||||
|
|
||||||
static void glui_render(void)
|
static void glui_render(void)
|
||||||
{
|
{
|
||||||
|
float delta_time;
|
||||||
int bottom;
|
int bottom;
|
||||||
unsigned width, height, header_height;
|
unsigned width, height, header_height;
|
||||||
glui_handle_t *glui = NULL;
|
glui_handle_t *glui = NULL;
|
||||||
|
@ -221,8 +222,8 @@ static void glui_render(void)
|
||||||
|
|
||||||
glui = (glui_handle_t*)menu->userdata;
|
glui = (glui_handle_t*)menu->userdata;
|
||||||
|
|
||||||
menu_animation_update(
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
||||||
menu_animation_get_delta_time() / IDEAL_DT);
|
menu_animation_update(delta_time / IDEAL_DT);
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &width);
|
menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &width);
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &height);
|
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &height);
|
||||||
|
|
|
@ -1392,6 +1392,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb,
|
||||||
|
|
||||||
static void xmb_render(void)
|
static void xmb_render(void)
|
||||||
{
|
{
|
||||||
|
float delta_time;
|
||||||
size_t selection;
|
size_t selection;
|
||||||
unsigned i, end, height = 0;
|
unsigned i, end, height = 0;
|
||||||
xmb_handle_t *xmb = NULL;
|
xmb_handle_t *xmb = NULL;
|
||||||
|
@ -1407,7 +1408,8 @@ static void xmb_render(void)
|
||||||
if (!xmb)
|
if (!xmb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu_animation_update(menu_animation_get_delta_time() / IDEAL_DT);
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
||||||
|
menu_animation_update(delta_time / IDEAL_DT);
|
||||||
|
|
||||||
video_driver_get_size(NULL, &height);
|
video_driver_get_size(NULL, &height);
|
||||||
|
|
||||||
|
|
|
@ -686,14 +686,6 @@ void menu_animation_clear_active(void)
|
||||||
anim->is_active = false;
|
anim->is_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float menu_animation_get_delta_time(void)
|
|
||||||
{
|
|
||||||
menu_animation_t *anim = menu_animation_get_ptr();
|
|
||||||
if (!anim)
|
|
||||||
return 0.0f;
|
|
||||||
return anim->delta_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
menu_animation_t *anim = menu_animation_get_ptr();
|
menu_animation_t *anim = menu_animation_get_ptr();
|
||||||
|
@ -702,6 +694,14 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
case MENU_ANIMATION_CTL_IS_ACTIVE:
|
case MENU_ANIMATION_CTL_IS_ACTIVE:
|
||||||
return anim->is_active;
|
return anim->is_active;
|
||||||
|
case MENU_ANIMATION_CTL_DELTA_TIME:
|
||||||
|
{
|
||||||
|
float *ptr = (float*)data;
|
||||||
|
if (!ptr)
|
||||||
|
return false;
|
||||||
|
*ptr = anim->delta_time;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -36,7 +36,8 @@ typedef void (*tween_cb) (void);
|
||||||
|
|
||||||
enum menu_animation_ctl_state
|
enum menu_animation_ctl_state
|
||||||
{
|
{
|
||||||
MENU_ANIMATION_CTL_IS_ACTIVE = 0
|
MENU_ANIMATION_CTL_IS_ACTIVE = 0,
|
||||||
|
MENU_ANIMATION_CTL_DELTA_TIME
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_animation_easing_type
|
enum menu_animation_easing_type
|
||||||
|
@ -117,8 +118,6 @@ void menu_animation_set_active(void);
|
||||||
|
|
||||||
void menu_animation_clear_active(void);
|
void menu_animation_clear_active(void);
|
||||||
|
|
||||||
float menu_animation_get_delta_time(void);
|
|
||||||
|
|
||||||
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
|
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1116,14 +1116,16 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
|
||||||
else if (abs(pointer_x - menu_input->pointer.start_x) > 3
|
else if (abs(pointer_x - menu_input->pointer.start_x) > 3
|
||||||
|| abs(pointer_y - menu_input->pointer.start_y) > 3)
|
|| abs(pointer_y - menu_input->pointer.start_y) > 3)
|
||||||
{
|
{
|
||||||
float s;
|
float s, delta_time;
|
||||||
menu_input->pointer.dragging = true;
|
menu_input->pointer.dragging = true;
|
||||||
menu_input->pointer.dx = pointer_x - menu_input->pointer.old_x;
|
menu_input->pointer.dx = pointer_x - menu_input->pointer.old_x;
|
||||||
menu_input->pointer.dy = pointer_y - menu_input->pointer.old_y;
|
menu_input->pointer.dy = pointer_y - menu_input->pointer.old_y;
|
||||||
menu_input->pointer.old_x = pointer_x;
|
menu_input->pointer.old_x = pointer_x;
|
||||||
menu_input->pointer.old_y = pointer_y;
|
menu_input->pointer.old_y = pointer_y;
|
||||||
|
|
||||||
s = menu_input->pointer.dy / menu_animation_get_delta_time() * 1000000.0;
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
||||||
|
|
||||||
|
s = menu_input->pointer.dy / delta_time * 1000000.0;
|
||||||
menu_input->pointer.accel = (menu_input->pointer.accel0 + menu_input->pointer.accel1 + s) / 3;
|
menu_input->pointer.accel = (menu_input->pointer.accel0 + menu_input->pointer.accel1 + s) / 3;
|
||||||
menu_input->pointer.accel0 = menu_input->pointer.accel1;
|
menu_input->pointer.accel0 = menu_input->pointer.accel1;
|
||||||
menu_input->pointer.accel1 = menu_input->pointer.accel;
|
menu_input->pointer.accel1 = menu_input->pointer.accel;
|
||||||
|
@ -1211,6 +1213,7 @@ void menu_input_post_iterate(int *ret, unsigned action)
|
||||||
|
|
||||||
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
|
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
|
||||||
{
|
{
|
||||||
|
float delta_time;
|
||||||
unsigned ret = MENU_ACTION_NOOP;
|
unsigned ret = MENU_ACTION_NOOP;
|
||||||
static bool initial_held = true;
|
static bool initial_held = true;
|
||||||
static bool first_held = false;
|
static bool first_held = false;
|
||||||
|
@ -1269,7 +1272,9 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
||||||
&new_scroll_accel);
|
&new_scroll_accel);
|
||||||
|
|
||||||
menu_input->delay.count += menu_animation_get_delta_time() / IDEAL_DT;
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
||||||
|
|
||||||
|
menu_input->delay.count += delta_time / IDEAL_DT;
|
||||||
|
|
||||||
if (menu_input->keyboard.display)
|
if (menu_input->keyboard.display)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue