void tween_manager_update(TweenManager* self, f32 dt) { for (u32 i = 0; i < self->capacity; ++i) { Tween* tween = &self->tweens[i]; if (tween->state != TWEEN_STATE_FREE) { tween_update(tween, dt); // If the most recent update finished if (tween->state == TWEEN_STATE_DESTROY) { //push the index back into the free indices stack ASSERT(self->freeHead < self->capacity - 1, "No room in free indices stack."); tween_zero(tween); ++self->freeHead; self->freeIndices[self->freeHead] = i; --self->count; } } } }
void engine_update() { // do smth here // update tweens list_t* it = tweens; list_t* safe; while (it) { safe = it->next; tween_update((tween*)(it->value)); it = safe; } game_update(); }