Switching SceneItems to smarts

This commit is contained in:
2023-11-12 23:02:11 -06:00
parent 91a91a5404
commit 54da3733d7
124 changed files with 188 additions and 216 deletions

View File

@ -0,0 +1,32 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "AnimationController.hpp"
#include "game/DawnGame.hpp"
using namespace Dawn;
AnimationController::AnimationController(SceneItem *item) :
SceneItemComponent(item)
{
}
void AnimationController::addAnimation(Animation *animation) {
assertNotNull(animation, "AnimationController::addAnimation: Animation cannot be null");
this->animations.push_back(animation);
}
void AnimationController::onStart() {
SceneItemComponent::onStart();
useEvent([&](float_t delta){
auto it = this->animations.begin();
while(it != this->animations.end()) {
(*it)->tick(delta);
++it;
}
}, getScene()->eventSceneUnpausedUpdate);
}