diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-22 13:41:47 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-22 13:41:47 +0100 |
commit | 7e2a5ee035524fff798d8f480e56aeca6b775f90 (patch) | |
tree | 145601592a2f6d93e4c31de27f6a0aa748f0a140 /src/crepe/facade/SDLContext.cpp | |
parent | c0f0cc3d95eed2b24d19a157933c2a0ff5d2d4c2 (diff) | |
parent | 9b4fecb5e3996a418502a696b79be92d226f23b1 (diff) |
Merge branch 'niels/rendering_transform_midpoint_bugfix' of github.com:lonkaars/crepe
Diffstat (limited to 'src/crepe/facade/SDLContext.cpp')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 00523a6..26327b0 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 Vector2 & 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), |