diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-20 14:06:54 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-20 14:06:54 +0100 |
commit | 3344e0df01435be903e38ccbd3b9cee608d574e7 (patch) | |
tree | 949a3a2d28ce143621f9da90aaea5361d95f9074 /src/crepe/system/RenderSystem.cpp | |
parent | 158022890cb9abd308a6a445588cc2fca8d84e67 (diff) |
implemented feedback
Diffstat (limited to 'src/crepe/system/RenderSystem.cpp')
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index 1ae5ca7..28bcf56 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -2,11 +2,11 @@ #include <vector> #include "../ComponentManager.h" +#include "../api/ParticleEmitter.h" #include "../api/Sprite.h" #include "../api/Transform.h" -#include "../facade/SDLContext.h" -#include "../api/ParticleEmitter.h" #include "../api/Vector2.h" +#include "../facade/SDLContext.h" #include "RenderSystem.h" @@ -21,13 +21,12 @@ void RenderSystem::update_camera() { auto cameras = mgr.get_components_by_type<Camera>(); for (Camera & cam : cameras) { - SDLContext::get_instance().camera(cam); + SDLContext::get_instance().set_camera(cam); this->curr_cam = &cam; } } -bool RenderSystem::render_particle(const Sprite & sprite, - const double & scale) { +bool RenderSystem::render_particle(const Sprite & sprite, const double & scale) const { ComponentManager & mgr = this->component_manager; SDLContext & render = SDLContext::get_instance(); @@ -49,22 +48,23 @@ bool RenderSystem::render_particle(const Sprite & sprite, } return rendering_particles; } -void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) { +void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) const { ComponentManager & mgr = this->component_manager; SDLContext & render = SDLContext::get_instance(); - + render.draw(sprite, tm, *curr_cam); } -void RenderSystem::render() { +void RenderSystem::render() const { ComponentManager & mgr = this->component_manager; auto sprites = mgr.get_components_by_type<Sprite>(); for (const Sprite & sprite : sprites) { if (!sprite.active) continue; - auto transform = mgr.get_components_by_id<Transform>(sprite.game_object_id).front().get(); + const Transform & transform + = mgr.get_components_by_id<Transform>(sprite.game_object_id).front().get(); bool rendered_particles = this->render_particle(sprite, transform.scale); |