Refactor update_tween - kivutar - verify if everything still

works as expected
This commit is contained in:
twinaphex 2014-10-11 05:23:49 +02:00
parent 67fe4f38d4
commit fb116af9cc
1 changed files with 21 additions and 17 deletions

View File

@ -58,8 +58,12 @@ 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; tween->running_since += dt;
if (tween->easing) if (tween->easing)
@ -76,9 +80,9 @@ static void update_tween(tween_t *tween, float dt, int *active_tweens)
if (tween->callback) if (tween->callback)
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)