mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-08 18:36:28 +00:00
Refactor away menu_animation_update
This commit is contained in:
parent
3aab741ef2
commit
9b18371a1a
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user