31 lines
696 B
C++
31 lines
696 B
C++
// Copyright (c) 2023 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "SimpleAnimation.hpp"
|
|
|
|
namespace Dawn {
|
|
template<typename T>
|
|
struct SimplerCallbackAnimation : public SimpleAnimation<T> {
|
|
protected:
|
|
T value;
|
|
|
|
void onValueModified() override {
|
|
SimpleAnimation<T>::onValueModified();
|
|
this->callback(this->value);
|
|
}
|
|
|
|
public:
|
|
std::function<void(T)> callback = std::function<void(T)>();
|
|
|
|
/**
|
|
* Construct a new Simple Function Animation object
|
|
*/
|
|
SimplerCallbackAnimation() :
|
|
SimpleAnimation<T>(&value)
|
|
{
|
|
}
|
|
};
|
|
} |