aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Animator.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-22 17:08:55 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-22 17:08:55 +0100
commit8513b2dad0ec43678f17cca0510db4d1a938279a (patch)
tree8437473da7eb9c7fae6369d2767fcd305fab856f /src/crepe/api/Animator.cpp
parent4ce924b1b1322ee4da3ba50d6da856ad13a2190b (diff)
working moving camera, flip animations, resizing with animations, and black bars
Diffstat (limited to 'src/crepe/api/Animator.cpp')
-rw-r--r--src/crepe/api/Animator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/crepe/api/Animator.cpp b/src/crepe/api/Animator.cpp
index d206428..178b165 100644
--- a/src/crepe/api/Animator.cpp
+++ b/src/crepe/api/Animator.cpp
@@ -18,7 +18,10 @@ Animator::Animator(game_object_id_t id, Sprite & ss, int row, int col, int col_a
animator_rect.h /= col;
animator_rect.w /= row;
animator_rect.x = 0;
- animator_rect.y = (col_animator - 1) * animator_rect.h;
+ animator_rect.y = col_animator * animator_rect.h;
this->active = false;
+
+ // need to do this for to get the aspect ratio for a single clipping in the spritesheet
+ this->spritesheet.aspect_ratio = (double)animator_rect.w / (double)animator_rect.h;
}
Animator::~Animator() { dbg_trace(); }