aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 11:35:25 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 11:35:25 +0100
commit52e84ca0a81210cd1dc61e096c228586649c9bfc (patch)
tree6442c070d225b4e348a3bc4603a52ad23f090da0 /src/crepe/system
parent193e837fce92dcc169f995f670c9261f853ea1c3 (diff)
updated adjsuted rendering based on feedback
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/RenderSystem.cpp8
-rw-r--r--src/crepe/system/RenderSystem.h3
2 files changed, 5 insertions, 6 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 39e0e3f..1ae5ca7 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -27,7 +27,7 @@ void RenderSystem::update_camera() {
}
bool RenderSystem::render_particle(const Sprite & sprite,
- Transform tm) {
+ const double & scale) {
ComponentManager & mgr = this->component_manager;
SDLContext & render = SDLContext::get_instance();
@@ -44,9 +44,7 @@ bool RenderSystem::render_particle(const Sprite & sprite,
for (const Particle & p : em.data.particles) {
if (!p.active) continue;
- tm.position = p.position;
- tm.rotation = p.angle;
- render.draw(em.data.sprite, tm, *curr_cam);
+ render.draw_particle(sprite, p.position, p.angle, scale, *this->curr_cam);
}
}
return rendering_particles;
@@ -68,7 +66,7 @@ void RenderSystem::render() {
if (!sprite.active) continue;
auto transform = mgr.get_components_by_id<Transform>(sprite.game_object_id).front().get();
- bool rendered_particles = this->render_particle(sprite, transform);
+ bool rendered_particles = this->render_particle(sprite, transform.scale);
if (rendered_particles) continue;
diff --git a/src/crepe/system/RenderSystem.h b/src/crepe/system/RenderSystem.h
index c18b80b..6643084 100644
--- a/src/crepe/system/RenderSystem.h
+++ b/src/crepe/system/RenderSystem.h
@@ -5,6 +5,7 @@
#include "api/Transform.h"
#include "System.h"
+#include <cmath>
namespace crepe {
@@ -51,7 +52,7 @@ private:
* \param tm the Transform component for scale
* \return true if particles have been rendered
*/
- bool render_particle(const Sprite &, Transform tm);
+ bool render_particle(const Sprite &, const double & scale);
/**
* \brief renders a sprite with a Transform component on the screen