From b1386fdf463ed41ef9e158d0f51f89eae1ffd3fa Mon Sep 17 00:00:00 2001 From: korenkonder Date: Tue, 9 Jan 2024 20:01:32 +0300 Subject: [PATCH] Moved `rectangle` to it's own file --- src/CRE/sprite.hpp | 20 +------------------- src/KKdLib/rectangle.hpp | 28 ++++++++++++++++++++++++++++ src/ReDIVA/dw.hpp | 3 ++- src/ReDIVA/font_info.hpp | 2 +- 4 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 src/KKdLib/rectangle.hpp diff --git a/src/CRE/sprite.hpp b/src/CRE/sprite.hpp index 2dccb867..5a3ae1fc 100644 --- a/src/CRE/sprite.hpp +++ b/src/CRE/sprite.hpp @@ -10,6 +10,7 @@ #include "../KKdLib/default.hpp" #include "../KKdLib/database/sprite.hpp" #include "../KKdLib/mat.hpp" +#include "../KKdLib/rectangle.hpp" #include "../KKdLib/vec.hpp" #include "color.hpp" #include "render_context.hpp" @@ -19,25 +20,6 @@ #define BREAK_SPRITE_VERTEX_LIMIT (1) -struct rectangle { - vec2 pos; - vec2 size; - - inline rectangle() : pos(), size() { - - } - - inline rectangle(vec2 pos, vec2 size) { - this->pos = pos; - this->size = size; - } - - inline rectangle(float_t pos_x, float_t pos_y, float_t size_x, float_t size_y) { - this->pos = { pos_x, pos_y }; - this->size = { size_x, size_y }; - } -}; - namespace spr { enum SprAttr : uint32_t { /*M_SPR_ATTR_SCALESIZE_X = 0x800, diff --git a/src/KKdLib/rectangle.hpp b/src/KKdLib/rectangle.hpp new file mode 100644 index 00000000..c0a1693c --- /dev/null +++ b/src/KKdLib/rectangle.hpp @@ -0,0 +1,28 @@ +/* + by korenkonder + GitHub/GitLab: korenkonder +*/ + +#pragma once + +#include "default.hpp" +#include "vec.hpp" + +struct rectangle { + vec2 pos; + vec2 size; + + inline rectangle() : pos(), size() { + + } + + inline rectangle(vec2 pos, vec2 size) { + this->pos = pos; + this->size = size; + } + + inline rectangle(float_t pos_x, float_t pos_y, float_t size_x, float_t size_y) { + this->pos = { pos_x, pos_y }; + this->size = { size_x, size_y }; + } +}; diff --git a/src/ReDIVA/dw.hpp b/src/ReDIVA/dw.hpp index 9e0aa681..3846e14a 100644 --- a/src/ReDIVA/dw.hpp +++ b/src/ReDIVA/dw.hpp @@ -6,8 +6,9 @@ #pragma once #include "../KKdLib/default.hpp" +#include "../KKdLib/rectangle.hpp" #include "../KKdLib/vec.hpp" -#include "../CRE/sprite.hpp" +#include "../CRE/color.hpp" #include "font_info.hpp" #include diff --git a/src/ReDIVA/font_info.hpp b/src/ReDIVA/font_info.hpp index e9e39924..4761b9cc 100644 --- a/src/ReDIVA/font_info.hpp +++ b/src/ReDIVA/font_info.hpp @@ -6,9 +6,9 @@ #pragma once #include "../KKdLib/default.hpp" +#include "../KKdLib/rectangle.hpp" #include "../KKdLib/vec.hpp" #include "../CRE/font.hpp" -#include "../CRE/sprite.hpp" struct font_char { rectangle tex;