diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-20 19:21:46 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-20 19:21:46 +0100 |
commit | 700892e9a2801902da31835c0069ae27da54cf4c (patch) | |
tree | e295850cd73afddc70ebd0d3c1937770a7720cfe | |
parent | 6b891f012828bfb780476ab0e757105ffdbfa15b (diff) |
implemented feedback
-rw-r--r-- | src/crepe/facade/SDLContext.h | 4 | ||||
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 11 | ||||
-rw-r--r-- | src/crepe/system/RenderSystem.h | 10 |
3 files changed, 13 insertions, 12 deletions
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index 9a514cb..3b17c0b 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -118,10 +118,10 @@ private: * \param transform Reference to the Transform for positioning. * \param camera Reference to the Camera for view adjustments. */ - void draw(const Sprite & sprite, const Transform & transform, const Camera & camera) const; + void draw(const Sprite & sprite, const Transform & transform, const Camera & camera) ; void draw_particle(const Sprite & sprite, const Vector2 & pos, const double & angle, - const double & scale, const Camera & camera) const; + const double & scale, const Camera & camera) ; //! Clears the screen, preparing for a new frame. void clear_screen(); diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index 05b7337..e379771 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -18,9 +18,9 @@ using namespace crepe; using namespace std; -void RenderSystem::clear_screen() const { this->context.clear_screen(); } +void RenderSystem::clear_screen() { this->context.clear_screen(); } -void RenderSystem::present_screen() const { this->context.present_screen(); } +void RenderSystem::present_screen() { this->context.present_screen(); } void RenderSystem::update_camera() { ComponentManager & mgr = this->component_manager; @@ -29,6 +29,7 @@ void RenderSystem::update_camera() { if (cameras.size() == 0) throw std::runtime_error("No cameras in current scene"); for (Camera & cam : cameras) { + if (!cam.active) continue; this->context.set_camera(cam); this->curr_cam_ref = &cam; } @@ -57,7 +58,7 @@ void RenderSystem::update() { this->present_screen(); } -bool RenderSystem::render_particle(const Sprite & sprite, const double & scale) const { +bool RenderSystem::render_particle(const Sprite & sprite, const double & scale) { ComponentManager & mgr = this->component_manager; @@ -79,11 +80,11 @@ bool RenderSystem::render_particle(const Sprite & sprite, const double & scale) } return rendering_particles; } -void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) const { +void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) { this->context.draw(sprite, tm, *this->curr_cam_ref); } -void RenderSystem::render() const { +void RenderSystem::render() { ComponentManager & mgr = this->component_manager; vector<reference_wrapper<Sprite>> sprites = mgr.get_components_by_type<Sprite>(); diff --git a/src/crepe/system/RenderSystem.h b/src/crepe/system/RenderSystem.h index 1a11d5b..5a2af17 100644 --- a/src/crepe/system/RenderSystem.h +++ b/src/crepe/system/RenderSystem.h @@ -31,16 +31,16 @@ public: private: //! Clears the screen in preparation for rendering. - void clear_screen() const; + void clear_screen() ; //! Presents the rendered frame to the display. - void present_screen() const; + void present_screen() ; //! Updates the active camera used for rendering. void update_camera(); //! Renders the whole screen - void render() const; + void render(); /** * \brief Renders all the particles on the screen from a given sprite. @@ -49,7 +49,7 @@ private: * \param tm the Transform component for scale * \return true if particles have been rendered */ - bool render_particle(const Sprite & sprite, const double & scale) const; + bool render_particle(const Sprite & sprite, const double & scale); /** * \brief renders a sprite with a Transform component on the screen @@ -57,7 +57,7 @@ private: * \param sprite the sprite component that holds all the data * \param tm the Transform component that holds the position,rotation and scale */ - void render_normal(const Sprite & sprite, const Transform & tm) const; + void render_normal(const Sprite & sprite, const Transform & tm); /** * \brief sort a vector sprite objects with |