aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AnimatorSystem.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-14 12:06:13 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-14 12:06:13 +0100
commit332fd8a0df85062e8474acab84b469afeb89f72b (patch)
treea06cf5beaadb721b18c1add881282e12b4a38a99 /src/crepe/system/AnimatorSystem.cpp
parent8e72da5b2fec93be40f0c0a7f3199fc12f7681c9 (diff)
parentb9fc66f6922b1f40f2dbe14e8dfc4caa469654bc (diff)
merge master
Diffstat (limited to 'src/crepe/system/AnimatorSystem.cpp')
-rw-r--r--src/crepe/system/AnimatorSystem.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp
index d61ba35..107b25d 100644
--- a/src/crepe/system/AnimatorSystem.cpp
+++ b/src/crepe/system/AnimatorSystem.cpp
@@ -2,21 +2,24 @@
#include "../api/Animator.h"
#include "../manager/ComponentManager.h"
-#include "api/LoopTimer.h"
+#include "../manager/LoopTimerManager.h"
+#include <chrono>
#include "AnimatorSystem.h"
using namespace crepe;
+using namespace std::chrono;
void AnimatorSystem::update() {
ComponentManager & mgr = this->mediator.component_manager;
- LoopTimer & timer = this->mediator.timer;
+ LoopTimerManager & timer = this->mediator.loop_timer;
RefVector<Animator> animations = mgr.get_components_by_type<Animator>();
- double elapsed_time = timer.get_current_time();
+ float elapsed_time = duration_cast<duration<float>>(timer.get_elapsed_time()).count();
for (Animator & a : animations) {
if (!a.active) continue;
+ if (a.data.fps == 0) continue;
Animator::Data & ctx = a.data;
float frame_duration = 1.0f / ctx.fps;