mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-24 05:31:15 +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)
|
||||
{
|
||||
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)
|
||||
*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->subject = tween->target_value;
|
||||
|
||||
if (tween->callback)
|
||||
tween->callback();
|
||||
}
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user