From 66bbea079bf1ae84c355349d337db468c18eac32 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Mon, 18 Nov 2024 21:07:26 +0100 Subject: feedback from PR#38 implemented --- src/crepe/facade/SDLContext.h | 5 ----- src/crepe/system/RenderSystem.cpp | 5 ++--- src/crepe/system/RenderSystem.h | 10 ++++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index 007092b..d437bc4 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -21,8 +21,6 @@ namespace crepe { // typedef is unusable when crepe is packaged. Wouter will fix this later. typedef SDL_Keycode CREPE_KEYCODES; -class Texture; -class LoopManager; /** * \class SDLContext @@ -91,9 +89,6 @@ private: //! Will use the funtions: texture_from_path, get_width,get_height. friend class Texture; - //! Will use the funtions: texture_from_path, get_width,get_height. - friend class Animator; - /** * \brief Loads a texture from a file path. * \param path Path to the image file. diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index bf5dade..11c20f5 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -22,7 +22,7 @@ void RenderSystem::update_camera() { for (Camera & cam : cameras) { SDLContext::get_instance().camera(cam); - this->curr_cam = &cam; + this->curr_cam_ref = &cam; } } @@ -35,7 +35,6 @@ bool sorting_comparison(const Sprite & a, const Sprite & b) { std::vector> RenderSystem::sort(std::vector> & objs) { - if (objs.empty()) return {}; std::vector> sorted_objs(objs); std::sort(sorted_objs.begin(), sorted_objs.end(), sorting_comparison); @@ -52,7 +51,7 @@ void RenderSystem::render_sprites() { SDLContext & render = SDLContext::get_instance(); for (const Sprite & sprite : sorted_sprites) { auto transforms = mgr.get_components_by_id(sprite.game_object_id); - render.draw(sprite, transforms[0], *curr_cam); + render.draw(sprite, transforms[0], *this->curr_cam_ref); } } diff --git a/src/crepe/system/RenderSystem.h b/src/crepe/system/RenderSystem.h index 7661cbd..1176b06 100644 --- a/src/crepe/system/RenderSystem.h +++ b/src/crepe/system/RenderSystem.h @@ -1,12 +1,14 @@ #pragma once -#include "api/Camera.h" -#include "System.h" -#include "api/Sprite.h" #include #include +#include "api/Sprite.h" +#include "api/Camera.h" + +#include "System.h" + namespace crepe { /** @@ -54,7 +56,7 @@ private: private: //! Pointer to the current active camera for rendering - Camera * curr_cam = nullptr; + Camera * curr_cam_ref = nullptr; // TODO: needs a better solution }; -- cgit v1.2.3