mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-28 09:05:38 +00:00
21 lines
384 B
C
21 lines
384 B
C
|
#pragma once
|
||
|
|
||
|
#include "Animation.h"
|
||
|
|
||
|
class LambdaAnimation : public Animation
|
||
|
{
|
||
|
public:
|
||
|
LambdaAnimation(const std::function<void(float t)>& func, int duration) : mFunction(func), mDuration(duration) {}
|
||
|
|
||
|
int getDuration() const override { return mDuration; }
|
||
|
|
||
|
void apply(float t) override
|
||
|
{
|
||
|
mFunction(t);
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
std::function<void(float t)> mFunction;
|
||
|
int mDuration;
|
||
|
};
|