Switching SceneItems to smarts
This commit is contained in:
32
archive/AnimationController.cpp
Normal file
32
archive/AnimationController.cpp
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user