aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.cpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-11-22 14:42:29 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-11-22 14:42:29 +0100
commit90f793932e40b2e1328c513a91830acb1a720f26 (patch)
treedf0abeb829de1b9c3387de133eb111e0dbd0534a /src/crepe/facade/SDLContext.cpp
parenta11b647bec22890be44d68d15de6b73f8955722d (diff)
parent7e2a5ee035524fff798d8f480e56aeca6b775f90 (diff)
Merge remote-tracking branch 'origin/master' into max/vector2
Diffstat (limited to 'src/crepe/facade/SDLContext.cpp')
-rw-r--r--src/crepe/facade/SDLContext.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index 1c75fe8..b3298a7 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -107,10 +107,10 @@ SDL_Rect SDLContext::get_src_rect(const Sprite & sprite) const {
SDL_Rect SDLContext::get_dst_rect(const Sprite & sprite, const vec2 & pos,
const double & scale, const Camera & cam) const {
- double adjusted_x = (pos.x - cam.x) * cam.zoom;
- double adjusted_y = (pos.y - cam.y) * cam.zoom;
double adjusted_w = sprite.sprite_rect.w * scale * cam.zoom;
double adjusted_h = sprite.sprite_rect.h * scale * cam.zoom;
+ double adjusted_x = (pos.x - cam.x) * cam.zoom - adjusted_w / 2;
+ double adjusted_y = (pos.y - cam.y) * cam.zoom - adjusted_h / 2;
return SDL_Rect{
.x = static_cast<int>(adjusted_x),