diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 25742f78d3..cc41eee5de 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -208,7 +208,7 @@ end: static void glui_render(void) { - float delta_time; + float delta_time, dt; int bottom; unsigned width, height, header_height; glui_handle_t *glui = NULL; @@ -222,8 +222,10 @@ static void glui_render(void) glui = (glui_handle_t*)menu->userdata; + menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - menu_animation_update(delta_time / IDEAL_DT); + dt = delta_time / IDEAL_DT; + menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE, &dt); menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &width); menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &height); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1bc0363290..5cf1c6812e 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1392,7 +1392,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, static void xmb_render(void) { - float delta_time; + float delta_time, dt; size_t selection; unsigned i, end, height = 0; xmb_handle_t *xmb = NULL; @@ -1409,7 +1409,8 @@ static void xmb_render(void) return; menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - menu_animation_update(delta_time / IDEAL_DT); + dt = delta_time / IDEAL_DT; + menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE, &dt); video_driver_get_size(NULL, &height); diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 611cb64dce..de0a594264 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -587,26 +587,6 @@ bool menu_animation_push(float duration, float target_value, float* subject, } -bool menu_animation_update(float dt) -{ - unsigned i; - unsigned active_tweens = 0; - menu_animation_t *anim = menu_animation_get_ptr(); - - for(i = 0; i < anim->size; i++) - menu_animation_iterate(anim, i, dt, &active_tweens); - - if (!active_tweens) - { - anim->size = 0; - anim->first_dead = 0; - return false; - } - - anim->is_active = true; - - return true; -} /** @@ -694,6 +674,28 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) } } return true; + case MENU_ANIMATION_CTL_UPDATE: + { + unsigned i; + unsigned active_tweens = 0; + float *dt = (float*)data; + + if (!dt) + return false; + + for(i = 0; i < anim->size; i++) + menu_animation_iterate(anim, i, *dt, &active_tweens); + + if (!active_tweens) + { + anim->size = 0; + anim->first_dead = 0; + return false; + } + + anim->is_active = true; + } + return true; } return false; diff --git a/menu/menu_animation.h b/menu/menu_animation.h index f64ee874d3..7f91316a44 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -40,7 +40,8 @@ enum menu_animation_ctl_state MENU_ANIMATION_CTL_CLEAR_ACTIVE, MENU_ANIMATION_CTL_SET_ACTIVE, MENU_ANIMATION_CTL_DELTA_TIME, - MENU_ANIMATION_CTL_UPDATE_TIME + MENU_ANIMATION_CTL_UPDATE_TIME, + MENU_ANIMATION_CTL_UPDATE }; enum menu_animation_easing_type @@ -99,8 +100,6 @@ void menu_animation_kill_by_tag(int tag); bool menu_animation_push(float duration, float target_value, float* subject, enum menu_animation_easing_type easing_enum, int tag, tween_cb cb); -bool menu_animation_update(float dt); - /** * menu_animation_ticker_str: * @s : buffer to write new message line to.