mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Refactor update_tween - kivutar - verify if everything still
works as expected
This commit is contained in:
parent
67fe4f38d4
commit
fb116af9cc
@ -58,27 +58,31 @@ void add_tween(float duration, float target_value, float* subject,
|
|||||||
|
|
||||||
static void update_tween(tween_t *tween, float dt, int *active_tweens)
|
static void update_tween(tween_t *tween, float dt, int *active_tweens)
|
||||||
{
|
{
|
||||||
if (tween && tween->running_since < tween->duration)
|
if (!tween)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (tween->running_since >= tween->duration)
|
||||||
|
return;
|
||||||
|
|
||||||
|
tween->running_since += dt;
|
||||||
|
|
||||||
|
if (tween->easing)
|
||||||
|
*tween->subject = tween->easing(
|
||||||
|
tween->running_since,
|
||||||
|
tween->initial_value,
|
||||||
|
tween->target_value - tween->initial_value,
|
||||||
|
tween->duration);
|
||||||
|
|
||||||
|
if (tween->running_since >= tween->duration)
|
||||||
{
|
{
|
||||||
tween->running_since += dt;
|
*tween->subject = tween->target_value;
|
||||||
|
|
||||||
if (tween->easing)
|
if (tween->callback)
|
||||||
*tween->subject = tween->easing(
|
tween->callback();
|
||||||
tween->running_since,
|
|
||||||
tween->initial_value,
|
|
||||||
tween->target_value - tween->initial_value,
|
|
||||||
tween->duration);
|
|
||||||
|
|
||||||
if (tween->running_since >= tween->duration)
|
|
||||||
{
|
|
||||||
*tween->subject = tween->target_value;
|
|
||||||
|
|
||||||
if (tween->callback)
|
|
||||||
tween->callback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*active_tweens += tween->running_since < tween->duration ? 1 : 0;
|
if (tween->running_since < tween->duration)
|
||||||
|
*active_tweens += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_tweens(float dt)
|
void update_tweens(float dt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user