diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-03-02 17:30:47 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-03-02 17:30:50 +0000 |
| commit | 34685a836a40648167848060b48b62788cdcc85f (patch) | |
| tree | d2f80358ccee9983f56ccf0aa9845083af5f8ba1 /src/managers/AnimationManager.cpp | |
| parent | dea71875e40d5ff4ad649b3c04b02419b06da5df (diff) | |
Move AnimationManager::tick() to an event loop
Diffstat (limited to 'src/managers/AnimationManager.cpp')
| -rw-r--r-- | src/managers/AnimationManager.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 456ae7f7..c2708038 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -1,9 +1,23 @@ #include "AnimationManager.hpp" #include "../Compositor.hpp" +int wlTick(void* data) { + + float refreshRate = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor->refreshRate : 60.f; + + wl_event_source_timer_update(g_pAnimationManager->m_pAnimationTick, 1000 / refreshRate); + + g_pAnimationManager->tick(); + + return 0; +} + CAnimationManager::CAnimationManager() { std::vector<Vector2D> points = {Vector2D(0, 0.75f), Vector2D(0.15f, 1.f)}; m_mBezierCurves["default"].setup(&points); + + m_pAnimationTick = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, &wlTick, nullptr); + wl_event_source_timer_update(m_pAnimationTick, 1); } void CAnimationManager::removeAllBeziers() { |
