From 7508f7b26e73df24e2fcb4296b31d26470fddf76 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Thu, 28 Nov 2024 10:20:23 +0100 Subject: adjusted more it should now be finsished --- src/crepe/api/Sprite.h | 24 ++++++++++++------------ src/crepe/facade/SDLContext.h | 12 ++++++++++++ src/crepe/system/RenderSystem.cpp | 3 +-- src/crepe/types.h | 15 +-------------- 4 files changed, 26 insertions(+), 28 deletions(-) (limited to 'src/crepe') diff --git a/src/crepe/api/Sprite.h b/src/crepe/api/Sprite.h index 9d75ab6..2d73879 100644 --- a/src/crepe/api/Sprite.h +++ b/src/crepe/api/Sprite.h @@ -8,18 +8,6 @@ namespace crepe { -struct Rect { - int w = 0; - int h = 0; - int x = 0; - int y = 0; -}; - -struct FlipSettings { - bool flip_x = false; - bool flip_y = false; -}; - class SDLContext; class Animator; class AnimatorSystem; @@ -32,6 +20,12 @@ class AnimatorSystem; */ class Sprite : public Component { +public: + struct FlipSettings { + bool flip_x = false; + bool flip_y = false; + }; + public: // TODO: Loek comment in github #27 will be looked another time // about shared_ptr Texture @@ -88,6 +82,12 @@ private: //! Reads the all the variables plus the sprite_rect friend class AnimatorSystem; + struct Rect { + int w = 0; + int h = 0; + int x = 0; + int y = 0; + }; //! Render area of the sprite this will also be adjusted by the AnimatorSystem if an Animator // object is present in GameObject. this is in sprite pixels Rect sprite_rect; diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index 7907a0f..25f2818 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -16,6 +16,16 @@ namespace crepe { +struct RenderCtx{ + const Sprite & sprite; + const Camera & cam; + const vec2 & cam_pos; + const vec2 & pos; + const double & angle; + const double & scale; + +}; + // TODO: SDL_Keycode is defined in a header not distributed with crepe, which means this // typedef is unusable when crepe is packaged. Wouter will fix this later. typedef SDL_Keycode CREPE_KEYCODES; @@ -29,6 +39,8 @@ typedef SDL_Keycode CREPE_KEYCODES; */ class SDLContext { + + public: /** * \brief Gets the singleton instance of SDLContext. diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index bfee658..0bef69b 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -9,9 +9,8 @@ #include "../api/ParticleEmitter.h" #include "../api/Sprite.h" #include "../api/Transform.h" +#include "../api/Camera.h" #include "../facade/SDLContext.h" -#include "api/Camera.h" -#include "types.h" #include "RenderSystem.h" diff --git a/src/crepe/types.h b/src/crepe/types.h index aa03f53..69cc526 100644 --- a/src/crepe/types.h +++ b/src/crepe/types.h @@ -27,17 +27,4 @@ typedef Vector2 vec2; //! Default Vector2 type typedef Vector2 dvec2; -class Sprite; -class Camera; - -struct RenderCtx{ - const Sprite & sprite; - const Camera & cam; - const vec2 & cam_pos; - const vec2 & pos; - const double & angle; - const double & scale; - -} ; - -} // namespace crepe +}; // namespace crepe -- cgit v1.2.3