aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/RenderSystem.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-18 19:17:38 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-18 19:17:38 +0100
commitd0286486b5fddcfb32dcd1f3010aef5368ee678e (patch)
treeb5d73c664ec0a1884dec4238eba866411d49d9d8 /src/crepe/system/RenderSystem.cpp
parentd8e6773be7206994716c29e1ee8195b10f094bdf (diff)
rendering met absoluut position util functie, particle ben ik nog jaro aan het overleggen dus er die werkt niet goed
Diffstat (limited to 'src/crepe/system/RenderSystem.cpp')
-rw-r--r--src/crepe/system/RenderSystem.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index bf2bfd3..ba09530 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -21,6 +21,7 @@
#include "RenderSystem.h"
#include "types.h"
+#include "util/AbsoluutPosition.h"
using namespace crepe;
using namespace std;
@@ -99,8 +100,7 @@ void RenderSystem::render_text() {
}
}
-bool RenderSystem::render_particle(const Sprite & sprite, const double & scale) {
-
+bool RenderSystem::render_particle(const Sprite & sprite, const Transform & tm){
ComponentManager & mgr = this->mediator.component_manager;
SDLContext & ctx = this->mediator.sdl_context;
ResourceManager & resource_manager = this->mediator.resource_manager;
@@ -122,9 +122,9 @@ bool RenderSystem::render_particle(const Sprite & sprite, const double & scale)
ctx.draw(SDLContext::RenderContext{
.sprite = sprite,
.texture = res,
- .pos = p.position,
+ .pos = AbsoluutPosition::get_position(tm, em.data.offset + sprite.data.position_offset),
.angle = p.angle,
- .scale = scale,
+ .scale = tm.scale,
});
}
}
@@ -138,7 +138,7 @@ void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) {
ctx.draw(SDLContext::RenderContext{
.sprite = sprite,
.texture = res,
- .pos = tm.position,
+ .pos = AbsoluutPosition::get_position(tm, sprite.data.position_offset),
.angle = tm.rotation,
.scale = tm.scale,
});
@@ -158,7 +158,7 @@ void RenderSystem::render() {
const Transform & transform
= mgr.get_components_by_id<Transform>(sprite.game_object_id).front().get();
- bool rendered_particles = this->render_particle(sprite, transform.scale);
+ bool rendered_particles = this->render_particle(sprite, transform);
if (rendered_particles) continue;