38 lines
780 B
C++
38 lines
780 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include "Animation.h"
|
|
|
|
class AnimationController
|
|
{
|
|
public:
|
|
enum DefaultAnimation {
|
|
FIRE_HOT = 0,
|
|
FIRE_COLD = 1,
|
|
|
|
NUM_DEFAULT_ANIMATIONS
|
|
};
|
|
|
|
AnimationController(Fader *fader);
|
|
|
|
void changeAnimation(std::unique_ptr<Animation> anim, bool transition = true);
|
|
void changeAnimation(DefaultAnimation animation_id, bool transition = true);
|
|
|
|
void loop(void);
|
|
|
|
void restart(void);
|
|
|
|
bool isIdle(void)
|
|
{
|
|
return m_animation->finished() && !m_nextAnimation;
|
|
}
|
|
|
|
private:
|
|
Fader *m_fader;
|
|
std::unique_ptr<Animation> m_animation;
|
|
std::unique_ptr<Animation> m_nextAnimation;
|
|
|
|
uint64_t m_frame;
|
|
};
|