aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/facade')
-rw-r--r--src/crepe/facade/SDLContext.cpp14
-rw-r--r--src/crepe/facade/SDLContext.h10
2 files changed, 16 insertions, 8 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index 29a8195..4619c46 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -107,8 +107,9 @@ SDL_Rect SDLContext::get_src_rect(const Sprite & sprite) const {
.h = sprite.sprite_rect.h,
};
}
-SDL_Rect SDLContext::get_dst_rect(const Sprite & sprite, const Vector2 & pos, const Vector2 & cam_pos,
- const double & img_scale, const Vector2 & cam_scale) const {
+SDL_Rect SDLContext::get_dst_rect(const Sprite & sprite, const Vector2 & pos,
+ const Vector2 & cam_pos, const double & img_scale,
+ const Vector2 & cam_scale) const {
int pixel_width, pixel_height;
@@ -135,7 +136,8 @@ SDL_Rect SDLContext::get_dst_rect(const Sprite & sprite, const Vector2 & pos, co
}
void SDLContext::draw_particle(const Sprite & sprite, const Vector2 & pos,
- const double & angle, const Vector2 & cam_pos, const double & img_scale, const Vector2 & cam_scale) {
+ const double & angle, const Vector2 & cam_pos,
+ const double & img_scale, const Vector2 & cam_scale) {
SDL_RendererFlip render_flip
= (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * sprite.flip.flip_x)
@@ -148,14 +150,16 @@ void SDLContext::draw_particle(const Sprite & sprite, const Vector2 & pos,
&dstrect, angle, NULL, render_flip);
}
-void SDLContext::draw(const Sprite & sprite, const Transform & transform, const Vector2 & cam_pos, const Vector2 & cam_scale) {
+void SDLContext::draw(const Sprite & sprite, const Transform & transform,
+ const Vector2 & cam_pos, const Vector2 & cam_scale) {
SDL_RendererFlip render_flip
= (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * sprite.flip.flip_x)
| (SDL_FLIP_VERTICAL * sprite.flip.flip_y));
SDL_Rect srcrect = this->get_src_rect(sprite);
- SDL_Rect dstrect = this->get_dst_rect(sprite, transform.position, cam_pos, transform.scale, cam_scale);
+ SDL_Rect dstrect
+ = this->get_dst_rect(sprite, transform.position, cam_pos, transform.scale, cam_scale);
SDL_RenderCopyEx(this->game_renderer.get(), sprite.sprite_image->texture.get(), &srcrect,
&dstrect, transform.rotation, NULL, render_flip);
diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h
index 04c60cc..4d97699 100644
--- a/src/crepe/facade/SDLContext.h
+++ b/src/crepe/facade/SDLContext.h
@@ -118,9 +118,12 @@ private:
* \param transform Reference to the Transform for positioning.
* \param camera Reference to the Camera for view adjustments.
*/
- void draw(const Sprite & sprite, const Transform & transform, const Vector2 & cam_pos, const Vector2 & cam_scale);
+ void draw(const Sprite & sprite, const Transform & transform, const Vector2 & cam_pos,
+ const Vector2 & cam_scale);
- void draw_particle(const Sprite & sprite, const Vector2 & pos, const double & angle, const Vector2 & cam_pos, const double & img_scale, const Vector2 & cam_scale);
+ void draw_particle(const Sprite & sprite, const Vector2 & pos, const double & angle,
+ const Vector2 & cam_pos, const double & img_scale,
+ const Vector2 & cam_scale);
//! Clears the screen, preparing for a new frame.
void clear_screen();
@@ -152,7 +155,8 @@ private:
* on the camera
* \return sdl rectangle to draw a dst image to draw on the screen
*/
- SDL_Rect get_dst_rect(const Sprite & sprite, const Vector2 & pos, const Vector2 & cam_pos, const double & img_scale , const Vector2 & scale) const;
+ SDL_Rect get_dst_rect(const Sprite & sprite, const Vector2 & pos, const Vector2 & cam_pos,
+ const double & img_scale, const Vector2 & scale) const;
private:
//! sdl Window