aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/RenderSystem.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-11 17:02:18 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-11 17:02:18 +0100
commit715be63e514066fec1962f47f85d0754cbf37755 (patch)
tree5c3bf3728cce9413be36f20021ffbe511bbba20f /src/crepe/system/RenderSystem.cpp
parent9b337ae01e4f3efc6ad3be5af33e3df8e9224d71 (diff)
parent30c17c98e54c1534664de08ca3838c40c859d166 (diff)
Merge branch 'master' into niels/UI
Diffstat (limited to 'src/crepe/system/RenderSystem.cpp')
-rw-r--r--src/crepe/system/RenderSystem.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 1ce9059..7de2673 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -10,7 +10,9 @@
#include "../api/Sprite.h"
#include "../api/Transform.h"
#include "../facade/SDLContext.h"
+#include "../facade/Texture.h"
#include "../manager/ComponentManager.h"
+#include "../manager/ResourceManager.h"
#include "types.h"
#include "RenderSystem.h"
@@ -72,6 +74,8 @@ bool RenderSystem::render_particle(const Sprite & sprite, const double & scale)
ComponentManager & mgr = this->mediator.component_manager;
SDLContext & ctx = this->mediator.sdl_context;
+ ResourceManager & resource_manager = this->mediator.resource_manager;
+ Texture & res = resource_manager.get<Texture>(sprite.source);
vector<reference_wrapper<ParticleEmitter>> emitters
= mgr.get_components_by_id<ParticleEmitter>(sprite.game_object_id);
@@ -88,6 +92,7 @@ bool RenderSystem::render_particle(const Sprite & sprite, const double & scale)
ctx.draw(SDLContext::RenderContext{
.sprite = sprite,
+ .texture = res,
.pos = p.position,
.angle = p.angle,
.scale = scale,
@@ -98,8 +103,12 @@ bool RenderSystem::render_particle(const Sprite & sprite, const double & scale)
}
void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) {
SDLContext & ctx = this->mediator.sdl_context;
+ ResourceManager & resource_manager = this->mediator.resource_manager;
+ const Texture & res = resource_manager.get<Texture>(sprite.source);
+
ctx.draw(SDLContext::RenderContext{
.sprite = sprite,
+ .texture = res,
.pos = tm.position,
.angle = tm.rotation,
.scale = tm.scale,