diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-26 10:03:06 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-26 10:03:06 +0100 |
commit | 8cfb59093ce7b18c2b81cc8429a7568a3ba21a73 (patch) | |
tree | f4ac31b930ca47bab53fdf46b05d4444173028c9 /src/crepe/facade | |
parent | 20ff7753942de3f8eb95d4dee307dc643bc66153 (diff) |
adjusted vector2 to vec2
Diffstat (limited to 'src/crepe/facade')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 20 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.h | 16 |
2 files changed, 17 insertions, 19 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index de7d08f..fc59d84 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> @@ -16,10 +15,9 @@ #include "../api/Sprite.h" #include "../api/Texture.h" #include "../api/Transform.h" -#include "../api/Vector2.h" #include "../util/Log.h" -#include "api/Vector2.h" +#include "types.h" #include "SDLContext.h" using namespace crepe; @@ -108,9 +106,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 vec2 & pos, + const vec2 & cam_pos, const double & img_scale, + const vec2 & cam_scale) const { int pixel_width, pixel_height; @@ -136,9 +134,9 @@ SDL_Rect SDLContext::get_dst_rect(const Sprite & sprite, const Vector2 & pos, }; } -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) { +void SDLContext::draw_particle(const Sprite & sprite, const vec2 & pos, + const double & angle, const vec2 & cam_pos, + const double & img_scale, const vec2 & cam_scale) { SDL_RendererFlip render_flip = (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * sprite.flip.flip_x) @@ -152,7 +150,7 @@ void SDLContext::draw_particle(const Sprite & sprite, const Vector2 & pos, } void SDLContext::draw(const Sprite & sprite, const Transform & transform, - const Vector2 & cam_pos, const Vector2 & cam_scale) { + const vec2 & cam_pos, const vec2 & cam_scale) { SDL_RendererFlip render_flip = (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * sprite.flip.flip_x) @@ -166,7 +164,7 @@ void SDLContext::draw(const Sprite & sprite, const Transform & transform, &dstrect, transform.rotation, NULL, render_flip); } -void SDLContext::set_camera(const Camera & cam, Vector2 & scale) { +void SDLContext::set_camera(const Camera & cam, vec2 & scale) { // resize window if (this->viewport.w != (int) cam.screen.x || this->viewport.h != (int) cam.screen.y) { diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index aed5797..c9f3299 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -120,8 +120,8 @@ private: * \param cam_pos position of the current camera in the scene * \param cam_scale multiplier for the world to screen */ - 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 vec2 & cam_pos, + const vec2 & cam_scale); /** * \brief Draws a particle to the screen using the specified parameters @@ -133,9 +133,9 @@ private: * \param img_scale scalar multiplier to increase image size * \param cam_scale camera scalar for world to screen */ - 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 vec2 & pos, const double & angle, + const vec2 & cam_pos, const double & img_scale, + const vec2 & cam_scale); //! Clears the screen, preparing for a new frame. void clear_screen(); @@ -147,7 +147,7 @@ private: * \brief sets the background of the camera (will be adjusted in future PR) * \param camera Reference to the Camera object. */ - void set_camera(const Camera & camera, Vector2 & scale); + void set_camera(const Camera & camera, vec2 & scale); private: /** @@ -168,8 +168,8 @@ private: * \param scale the multiplier for world to screen * \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 vec2 & pos, const vec2 & cam_pos, + const double & img_scale, const vec2 & scale) const; private: //! sdl Window |