aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-30 21:02:27 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-30 21:02:27 +0100
commit6ae0b9038e432869b506cbdfe2779e97d3732d87 (patch)
tree7fadff8dd2125c48422ab10c6faa532650f8327a /src/crepe/facade
parent1520cb55ad714583c3903f2988b0fdc38ede9c18 (diff)
improved animator
Diffstat (limited to 'src/crepe/facade')
-rw-r--r--src/crepe/facade/SDLContext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index 1f729b2..f0a21d5 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -113,7 +113,11 @@ SDL_Rect SDLContext::get_src_rect(const Sprite & sprite) const {
SDL_FRect SDLContext::get_dst_rect(const DstRect & ctx) const {
- vec2 size = {(ctx.sprite.height * ctx.sprite.aspect_ratio), ctx.sprite.height};
+
+ vec2 size = {
+ ctx.sprite.size.x == 0 && ctx.sprite.size.y != 0 ? ctx.sprite.size.y * ctx.sprite.aspect_ratio : ctx.sprite.size.x,
+ ctx.sprite.size.y == 0 && ctx.sprite.size.x != 0 ? ctx.sprite.size.x / ctx.sprite.aspect_ratio : ctx.sprite.size.y
+ };
const CameraValues & cam = ctx.cam;