From 8f6c5d220d3e4c250db4bf3022f99c38811b63fd Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 26 Aug 2024 17:39:07 +0200 Subject: Move FloatRect to Rect --- include/mglpp/system/FloatRect.hpp | 22 +--------------------- include/mglpp/system/Rect.hpp | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 include/mglpp/system/Rect.hpp diff --git a/include/mglpp/system/FloatRect.hpp b/include/mglpp/system/FloatRect.hpp index 50941dd..3ed0a0d 100644 --- a/include/mglpp/system/FloatRect.hpp +++ b/include/mglpp/system/FloatRect.hpp @@ -1,26 +1,6 @@ #ifndef MGLPP_FLOAT_RECT_HPP #define MGLPP_FLOAT_RECT_HPP -#include "../system/vec.hpp" - -namespace mgl { - template - class Rect { - public: - Rect() : position(0, 0), size(0, 0) {} - Rect(vec2 position, vec2 size) : position(position), size(size) {} - - bool contains(vec2 point) const { - return point.x >= position.x && point.x <= position.x + size.x - && point.y >= position.y && point.y <= position.y + size.y; - } - - vec2 position; - vec2 size; - }; - - typedef Rect IntRect; - typedef Rect FloatRect; -} +#include "Rect.hpp" #endif /* MGLPP_FLOAT_RECT_HPP */ diff --git a/include/mglpp/system/Rect.hpp b/include/mglpp/system/Rect.hpp new file mode 100644 index 0000000..ba566cb --- /dev/null +++ b/include/mglpp/system/Rect.hpp @@ -0,0 +1,26 @@ +#ifndef MGLPP_RECT_HPP +#define MGLPP_RECT_HPP + +#include "../system/vec.hpp" + +namespace mgl { + template + class Rect { + public: + Rect() : position(0, 0), size(0, 0) {} + Rect(vec2 position, vec2 size) : position(position), size(size) {} + + bool contains(vec2 point) const { + return point.x >= position.x && point.x <= position.x + size.x + && point.y >= position.y && point.y <= position.y + size.y; + } + + vec2 position; + vec2 size; + }; + + typedef Rect IntRect; + typedef Rect FloatRect; +} + +#endif /* MGLPP_RECT_HPP */ -- cgit v1.2.3