aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2025-01-06 11:27:23 +0100
committerJAROWMR <jarorutjes07@gmail.com>2025-01-06 11:27:23 +0100
commita9fba4fa1fc348cdbbd60e9bda58b62b35019380 (patch)
treeff0d4c33f34573c7b44c17902dd953a56d4e4799
parentc35a53ff122d9ea3547ef8ae6035bd9e1b10d4cb (diff)
parent958475050c80addf584b6a166649c337c68a879f (diff)
Merge branch 'niels/UI' of github.com:lonkaars/crepe into jaro/main-menu
-rw-r--r--src/crepe/api/Animator.h2
-rw-r--r--src/crepe/system/AnimatorSystem.cpp9
-rw-r--r--src/example/rendering_particle.cpp2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/crepe/api/Animator.h b/src/crepe/api/Animator.h
index efc2f6e..95539d3 100644
--- a/src/crepe/api/Animator.h
+++ b/src/crepe/api/Animator.h
@@ -1,7 +1,7 @@
#pragma once
-#include "../types.h"
#include "../manager/LoopTimerManager.h"
+#include "../types.h"
#include "Component.h"
#include "Sprite.h"
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp
index 1a0cde9..ec9a445 100644
--- a/src/crepe/system/AnimatorSystem.cpp
+++ b/src/crepe/system/AnimatorSystem.cpp
@@ -34,14 +34,15 @@ void AnimatorSystem::frame_update() {
int total_frames = cycle_end - ctx.cycle_start;
int curr_cycle_frame = (a.frame - ctx.cycle_start) % total_frames;
+ if (!ctx.looping && a.frame >= cycle_end) {
+ a.active = false;
+ continue;
+ }
+
ctx.row = (ctx.cycle_start + curr_cycle_frame) % a.grid_size.x;
ctx.col = curr_cycle_frame / a.grid_size.x;
a.spritesheet.mask.x = ctx.row * a.spritesheet.mask.w;
a.spritesheet.mask.y = ctx.col * a.spritesheet.mask.y;
-
- if (!ctx.looping && a.frame >= cycle_end) {
- a.active = false;
- }
}
}
diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp
index 0082b91..c28d6a0 100644
--- a/src/example/rendering_particle.cpp
+++ b/src/example/rendering_particle.cpp
@@ -46,7 +46,7 @@ public:
game_object.add_component<Animator>(
test_sprite, ivec2 {56, 56}, uvec2 {4, 4},
Animator::Data {
- .looping = true,
+ .looping = false,
}
);