diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-17 18:45:46 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-17 18:45:46 +0100 |
commit | b1c82f914f18457f9a30791b01896ea40832c2d3 (patch) | |
tree | 6c70f8336fb408f05a7e1816369008a2954065d0 /src/crepe/facade/SDLContext.cpp | |
parent | 9885c58817912125506de3b3555f3dc6206e0e6a (diff) |
bounce
Diffstat (limited to 'src/crepe/facade/SDLContext.cpp')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 274cd7a..5d22cdf 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -117,8 +117,8 @@ void SDLContext::draw(const Sprite & sprite, const Transform & transform, = (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * sprite.flip.flip_x) | (SDL_FLIP_VERTICAL * sprite.flip.flip_y)); - double adjusted_x = (transform.position.x - cam.x) * cam.zoom; - double adjusted_y = (transform.position.y - cam.y) * cam.zoom; + double adjusted_x = (transform.position.x - cam.x -(sprite.sprite_rect.w/2)) * cam.zoom; + double adjusted_y = (transform.position.y - cam.y -(sprite.sprite_rect.h/2)) * cam.zoom; double adjusted_w = sprite.sprite_rect.w * transform.scale * cam.zoom; double adjusted_h = sprite.sprite_rect.h * transform.scale * cam.zoom; @@ -130,8 +130,8 @@ void SDLContext::draw(const Sprite & sprite, const Transform & transform, }; SDL_Rect dstrect = { - .x = static_cast<int>(adjusted_x/2), - .y = static_cast<int>(adjusted_y/2), + .x = static_cast<int>(adjusted_x), + .y = static_cast<int>(adjusted_y), .w = static_cast<int>(adjusted_w), .h = static_cast<int>(adjusted_h), }; |