diff options
Diffstat (limited to 'src/crepe/system')
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 10 | ||||
-rw-r--r-- | src/crepe/system/RenderSystem.h | 5 |
2 files changed, 6 insertions, 9 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, diff --git a/src/crepe/system/RenderSystem.h b/src/crepe/system/RenderSystem.h index e70831e..9ff015e 100644 --- a/src/crepe/system/RenderSystem.h +++ b/src/crepe/system/RenderSystem.h @@ -76,9 +76,8 @@ private: private: SDLContext & context = SDLContext::get_instance(); - - //! camera postion in the current scene - vec2 cam_pos; + + SDLContext::CameraValues cam_ctx; }; } // namespace crepe |