mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-12-01 02:25:39 +00:00
7e9b20fac5
Added LambdaAnimation (which lets you use a lambda for the apply method). Useful for simple one-off animations. Added animation slots - only one animation can play per slot. This way you can have two animations run at the same time.
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;
|
|
};
|