mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
23 lines
562 B
C
23 lines
562 B
C
![]() |
#pragma once
|
||
|
|
||
|
#include <memory>
|
||
|
#include <functional>
|
||
|
#include "Animation.h"
|
||
|
|
||
|
class AnimationController
|
||
|
{
|
||
|
public:
|
||
|
// FinishedCallback is guaranteed to be called exactly once, even if the animation does not finish normally.
|
||
|
// Takes ownership of anim (will delete in destructor).
|
||
|
AnimationController(Animation* anim, std::function<void()> finishedCallback = nullptr, bool reverse = false);
|
||
|
virtual ~AnimationController();
|
||
|
|
||
|
void update(int deltaTime);
|
||
|
|
||
|
private:
|
||
|
Animation* mAnimation;
|
||
|
std::function<void()> mFinishedCallback;
|
||
|
bool mReverse;
|
||
|
int mTime;
|
||
|
};
|