aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/AnimatedVariable.cpp
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-04-23 14:16:02 +0200
committervaxerski <[email protected]>2022-04-23 14:16:02 +0200
commit0147975faf939db389bebaa95e3a12e5e5a8753f (patch)
treec6933763435812460ebdc9609ed90eae21110753 /src/helpers/AnimatedVariable.cpp
parentfa38dfd416b664033a96bb4af764fd54f7257d7b (diff)
downloadHyprland-0147975faf939db389bebaa95e3a12e5e5a8753f.tar.gz
Hyprland-0147975faf939db389bebaa95e3a12e5e5a8753f.zip
New animation system
Diffstat (limited to 'src/helpers/AnimatedVariable.cpp')
-rw-r--r--src/helpers/AnimatedVariable.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp
new file mode 100644
index 00000000..581ea1c8
--- /dev/null
+++ b/src/helpers/AnimatedVariable.cpp
@@ -0,0 +1,54 @@
+#include "AnimatedVariable.hpp"
+#include "../managers/AnimationManager.hpp"
+
+CAnimatedVariable::CAnimatedVariable() {
+ ; // dummy var
+}
+
+void CAnimatedVariable::create(ANIMATEDVARTYPE type, float* speed, int64_t* enabled, void* pWindow) {
+ m_eVarType = type;
+ m_pSpeed = speed;
+ m_pEnabled = enabled;
+ m_pWindow = pWindow;
+
+ g_pAnimationManager->m_lAnimatedVariables.push_back(this);
+
+ m_bDummy = false;
+}
+
+void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, float* speed, int64_t* enabled, void* pWindow) {
+ create(type, speed, enabled, pWindow);
+
+ try {
+ switch (type) {
+ case AVARTYPE_FLOAT: {
+ const auto V = std::any_cast<float>(val);
+ m_fValue = V;
+ m_fGoal = V;
+ break;
+ }
+ case AVARTYPE_VECTOR: {
+ const auto V = std::any_cast<Vector2D>(val);
+ m_vValue = V;
+ m_vGoal = V;
+ break;
+ }
+ case AVARTYPE_COLOR: {
+ const auto V = std::any_cast<CColor>(val);
+ m_cValue = V;
+ m_cGoal = V;
+ break;
+ }
+ default:
+ ASSERT(false);
+ break;
+ }
+ } catch (std::exception& e) {
+ Debug::log(ERR, "CAnimatedVariable create error: %s", e.what());
+ RASSERT(false, "CAnimatedVariable create error: %s", e.what());
+ }
+}
+
+CAnimatedVariable::~CAnimatedVariable() {
+ g_pAnimationManager->m_lAnimatedVariables.remove(this);
+} \ No newline at end of file