Switching SceneItems to smarts
This commit is contained in:
31
archive/animation/SimplerCallbackAnimation.hpp
Normal file
31
archive/animation/SimplerCallbackAnimation.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
// 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)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user