aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 21:07:26 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 21:07:26 +0100
commit66bbea079bf1ae84c355349d337db468c18eac32 (patch)
tree68a3d8baf7e8104a375b0d5a2c515cdd8b03951f /src
parentbae2501c9e2604497db152d5e3df6a018cdd6858 (diff)
feedback from PR#38 implemented
Diffstat (limited to 'src')
-rw-r--r--src/crepe/facade/SDLContext.h5
-rw-r--r--src/crepe/system/RenderSystem.cpp5
-rw-r--r--src/crepe/system/RenderSystem.h10
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<std::reference_wrapper<Sprite>>
RenderSystem::sort(std::vector<std::reference_wrapper<Sprite>> & objs) {
- if (objs.empty()) return {};
std::vector<std::reference_wrapper<Sprite>> 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<Transform>(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 <functional>
#include <vector>
+#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
};