summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-05-15 17:11:51 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-05-15 17:11:51 +0100
commit5b84b0fb445bc4485510bba516c84141aaeafd04 (patch)
tree0ce2b218fe3e8d8f607d27046ba510da70fb6ba8 /src/helpers
parent621eac32d3107b4f36cad6863948a576152ccf37 (diff)
animationmgr: allow empty avars
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/AnimatedVariable.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index 1538b0ce..eca9c74b 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -3,14 +3,16 @@
#include "../defines.hpp"
#include <any>
-enum ANIMATEDVARTYPE {
+enum ANIMATEDVARTYPE
+{
AVARTYPE_INVALID = -1,
AVARTYPE_FLOAT,
AVARTYPE_VECTOR,
AVARTYPE_COLOR
};
-enum AVARDAMAGEPOLICY {
+enum AVARDAMAGEPOLICY
+{
AVARDAMAGE_NONE = -1,
AVARDAMAGE_ENTIRE = 0,
AVARDAMAGE_BORDER,
@@ -209,10 +211,17 @@ class CAnimatedVariable {
m_bRemoveBeginAfterRan = remove;
}
+ /* Sets the update callback, called every time the value is animated and a step is done
+ Warning: calling unregisterVar/registerVar in this handler will cause UB */
+ void setUpdateCallback(std::function<void(void* thisptr)> func) {
+ m_fUpdateCallback = func;
+ }
+
/* resets all callbacks. Does not call any. */
void resetAllCallbacks() {
m_fBeginCallback = nullptr;
m_fEndCallback = nullptr;
+ m_fUpdateCallback = nullptr;
m_bRemoveBeginAfterRan = false;
m_bRemoveEndAfterRan = false;
}
@@ -249,6 +258,7 @@ class CAnimatedVariable {
bool m_bRemoveBeginAfterRan = true;
std::function<void(void* thisptr)> m_fEndCallback;
std::function<void(void* thisptr)> m_fBeginCallback;
+ std::function<void(void* thisptr)> m_fUpdateCallback;
// methods
void onAnimationEnd() {