diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-02 21:00:54 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-02 21:00:54 +0100 |
commit | 0a1739de21e5ab270cb45efb6fc0aed092d81227 (patch) | |
tree | ab4019d595fce2410c5ca5d0fd98ad6d8205c079 /src/crepe/system | |
parent | a84ca09e97d466643f022acfffcf4c6a77f42052 (diff) |
added all the contructor strutcts for animator,sprite and camera
Diffstat (limited to 'src/crepe/system')
-rw-r--r-- | src/crepe/system/AnimatorSystem.cpp | 6 | ||||
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp index b1f23d1..ff8d2ce 100644 --- a/src/crepe/system/AnimatorSystem.cpp +++ b/src/crepe/system/AnimatorSystem.cpp @@ -4,7 +4,6 @@ #include "AnimatorSystem.h" #include "ComponentManager.h" -#include <iostream> using namespace crepe; @@ -21,7 +20,7 @@ void AnimatorSystem::update() { Animator::Data & ctx = a.data; double frame_duration = 1.0f / ctx.fps; - int cycle_end = (ctx.cycle_end == -1) ? ctx.row : cycle_end; + int cycle_end = (ctx.cycle_end == -1) ? ctx.row : ctx.cycle_end; int total_frames = cycle_end - ctx.cycle_start; int curr_frame = static_cast<int>(elapsed_time / frame_duration) % total_frames; @@ -30,8 +29,7 @@ void AnimatorSystem::update() { ctx.spritesheet.mask.x = ctx.curr_row * ctx.spritesheet.mask.w; ctx.spritesheet.mask.y = (ctx.curr_col * ctx.spritesheet.mask.h); - std::cout << curr_frame << " " << total_frames << std::endl; - if (!ctx.looping && curr_frame == 0) { + if (!ctx.looping && curr_frame == total_frames - 1) { a.active = false; } } diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index 08f254f..1bf5f65 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -33,7 +33,7 @@ const Camera & RenderSystem::update_camera() { const Transform & transform = mgr.get_components_by_id<Transform>(cam.game_object_id).front().get(); this->context.set_camera(cam, this->cam_ctx); - this->cam_ctx.cam_pos = transform.position + cam.offset; + this->cam_ctx.cam_pos = transform.position + cam.data.offset; return cam; } throw std::runtime_error("No active cameras in current scene"); |