mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
(menu_animation) Detect when defrag is really needed
This commit is contained in:
parent
c384f56e4f
commit
26a9648c4f
@ -44,6 +44,7 @@ struct tween
|
||||
struct menu_animation
|
||||
{
|
||||
struct tween *list;
|
||||
bool need_defrag;
|
||||
|
||||
size_t capacity;
|
||||
size_t size;
|
||||
@ -459,6 +460,8 @@ bool menu_animation_push(menu_animation_ctx_entry_t *entry)
|
||||
|
||||
*target = t;
|
||||
|
||||
anim.need_defrag = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -486,6 +489,7 @@ static void menu_animation_defrag()
|
||||
}
|
||||
|
||||
anim.first_dead = anim.size;
|
||||
anim.need_defrag = false;
|
||||
}
|
||||
|
||||
bool menu_animation_update(float delta_time)
|
||||
@ -511,6 +515,7 @@ bool menu_animation_update(float delta_time)
|
||||
{
|
||||
*tween->subject = tween->target_value;
|
||||
tween->alive = false;
|
||||
anim.need_defrag = true;
|
||||
|
||||
if (tween->cb)
|
||||
tween->cb();
|
||||
@ -520,12 +525,14 @@ bool menu_animation_update(float delta_time)
|
||||
active_tweens += 1;
|
||||
}
|
||||
|
||||
if (active_tweens)
|
||||
if (anim.need_defrag)
|
||||
menu_animation_defrag();
|
||||
else
|
||||
|
||||
if (!active_tweens)
|
||||
{
|
||||
anim.size = 0;
|
||||
anim.first_dead = 0;
|
||||
anim.need_defrag = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -663,6 +670,8 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||
|
||||
if (i < anim.first_dead)
|
||||
anim.first_dead = i;
|
||||
|
||||
anim.need_defrag = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -690,6 +699,7 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||
anim.first_dead = i;
|
||||
|
||||
killed++;
|
||||
anim.need_defrag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user