aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/AnimatorSystem.cpp1
-rw-r--r--src/crepe/system/AnimatorSystem.h3
-rw-r--r--src/crepe/system/RenderSystem.cpp8
-rw-r--r--src/crepe/system/RenderSystem.h3
4 files changed, 9 insertions, 6 deletions
diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp
index 676e485..bc94253 100644
--- a/src/crepe/system/AnimatorSystem.cpp
+++ b/src/crepe/system/AnimatorSystem.cpp
@@ -16,6 +16,7 @@ void AnimatorSystem::update() {
uint64_t tick = SDLContext::get_instance().get_ticks();
for (Animator & a : animations) {
if (a.active) {
+ // (10 frames per second)
a.curr_row = (tick / 100) % a.row;
a.animator_rect.x = (a.curr_row * a.animator_rect.w) + a.curr_col;
a.spritesheet.sprite_rect = a.animator_rect;
diff --git a/src/crepe/system/AnimatorSystem.h b/src/crepe/system/AnimatorSystem.h
index 56cc7b3..f8179a9 100644
--- a/src/crepe/system/AnimatorSystem.h
+++ b/src/crepe/system/AnimatorSystem.h
@@ -21,12 +21,11 @@ public:
/**
* \brief Updates the Animator components.
*
- * This method is called periodically (likely every frame) to update the state of all
+ * This method is called to update the state of all
* Animator components, moving the animations forward and managing their behavior (e.g.,
* looping).
*/
void update() override;
- // FIXME: never say "likely" in the documentation lmao
};
} // namespace crepe
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index ad510f5..1dd1699 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -30,7 +30,7 @@ void RenderSystem::update_camera() {
for (Camera & cam : cameras) {
if (!cam.active) continue;
- this->context.set_camera(cam);
+ this->context.set_camera(cam, this->scale);
this->curr_cam_ref = &cam;
}
}
@@ -72,14 +72,14 @@ bool RenderSystem::render_particle(const Sprite & sprite, const double & scale)
for (const Particle & p : em.data.particles) {
if (!p.active) continue;
- this->context.draw_particle(sprite, p.position, p.angle, scale,
- *this->curr_cam_ref);
+ this->context.draw_particle(sprite, p.position, p.angle, this->curr_cam_ref->pos,
+ scale, this->scale);
}
}
return rendering_particles;
}
void RenderSystem::render_normal(const Sprite & sprite, const Transform & tm) {
- this->context.draw(sprite, tm, *this->curr_cam_ref);
+ this->context.draw(sprite, tm, this->curr_cam_ref->pos, this->scale);
}
void RenderSystem::render() {
diff --git a/src/crepe/system/RenderSystem.h b/src/crepe/system/RenderSystem.h
index 30b41cf..f010a83 100644
--- a/src/crepe/system/RenderSystem.h
+++ b/src/crepe/system/RenderSystem.h
@@ -3,6 +3,7 @@
#include <functional>
#include <vector>
+#include "api/Vector2.h"
#include "facade/SDLContext.h"
#include "System.h"
@@ -81,6 +82,8 @@ private:
Camera * curr_cam_ref = nullptr;
// TODO: needs a better solution
+ Vector2 scale;
+
SDLContext & context = SDLContext::get_instance();
};