aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/facade')
-rw-r--r--src/crepe/facade/SDLContext.cpp8
-rw-r--r--src/crepe/facade/SDLContext.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index 9c2ead4..bba26a3 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -8,7 +8,6 @@
#include <cmath>
#include <cstddef>
#include <functional>
-#include <iostream>
#include <memory>
#include <stdexcept>
@@ -113,6 +112,7 @@ SDL_Rect SDLContext::get_src_rect(const Sprite & sprite) const {
SDL_FRect SDLContext::get_dst_rect(const DstRect & ctx) const {
+ // this might not work all the time because of float checking zero -_-
vec2 size = {ctx.sprite.size.x == 0 && ctx.sprite.size.y != 0
? ctx.sprite.size.y * ctx.sprite.aspect_ratio
: ctx.sprite.size.x,
@@ -122,7 +122,7 @@ SDL_FRect SDLContext::get_dst_rect(const DstRect & ctx) const {
const CameraValues & cam = ctx.cam;
- size *= cam.render_scale * ctx.img_scale;
+ size *= cam.render_scale * ctx.img_scale * ctx.sprite.scale;
vec2 screen_pos = (ctx.pos - cam.cam_pos + (cam.zoomed_viewport) / 2) * cam.render_scale
- size / 2 + cam.bar_size;
@@ -149,8 +149,10 @@ void SDLContext::draw(const RenderContext & ctx) {
.img_scale = ctx.scale,
});
+ double angle = ctx.angle + ctx.sprite.angle_offset;
+
SDL_RenderCopyExF(this->game_renderer.get(), ctx.sprite.sprite_image.texture.get(),
- &srcrect, &dstrect, ctx.angle, NULL, render_flip);
+ &srcrect, &dstrect, angle, NULL, render_flip);
}
void SDLContext::set_camera(const Camera & cam, CameraValues & ctx) {
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index cd52be6..0a6fce6 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -67,8 +67,6 @@ private:
void handle_events(bool & running);
private:
- //! Will only use get_ticks
- friend class AnimatorSystem;
//! Will only use delay
friend class LoopTimer;
/**