diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-30 16:44:47 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-30 16:44:47 +0100 |
commit | 1520cb55ad714583c3903f2988b0fdc38ede9c18 (patch) | |
tree | 49123f0f86eefc59e4cb9d12b87e67b2b9d62ab3 /src/crepe/system/RenderSystem.cpp | |
parent | ad4f8acfb252b8be3a3fbb74ed97b32e498a26a4 (diff) |
cleaner camera implementation
Diffstat (limited to 'src/crepe/system/RenderSystem.cpp')
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index c196bb1..944ac86 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -32,8 +32,8 @@ const Camera & RenderSystem::update_camera() { if (!cam.active) continue; const Transform & transform = mgr.get_components_by_id<Transform>(cam.game_object_id).front().get(); - this->context.set_camera(cam); - this->cam_pos = transform.position + cam.offset; + this->context.set_camera(cam, this->cam_ctx); + this->cam_ctx.cam_pos = transform.position + cam.offset; return cam; } throw std::runtime_error("No active cameras in current scene"); @@ -79,8 +79,7 @@ bool RenderSystem::render_particle(const Sprite & sprite, const Camera & cam, this->context.draw(SDLContext::RenderContext{ .sprite = sprite, - .cam = cam, - .cam_pos = this->cam_pos, + .cam = this->cam_ctx, .pos = p.position, .angle = p.angle, .scale = scale, @@ -93,8 +92,7 @@ void RenderSystem::render_normal(const Sprite & sprite, const Camera & cam, const Transform & tm) { this->context.draw(SDLContext::RenderContext{ .sprite = sprite, - .cam = cam, - .cam_pos = this->cam_pos, + .cam = this->cam_ctx, .pos = tm.position, .angle = tm.rotation, .scale = tm.scale, |