diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-26 17:39:07 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-26 17:39:07 +0200 |
commit | 8f6c5d220d3e4c250db4bf3022f99c38811b63fd (patch) | |
tree | 2b85db94a58f5083b7397bbb33fb5e8744c4dc01 /include | |
parent | 685cd2d470b399a7aa82ae6a2942ffb0afefab9b (diff) |
Move FloatRect to Rect
Diffstat (limited to 'include')
-rw-r--r-- | include/mglpp/system/FloatRect.hpp | 22 | ||||
-rw-r--r-- | include/mglpp/system/Rect.hpp | 26 |
2 files changed, 27 insertions, 21 deletions
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 <typename T> - class Rect { - public: - Rect() : position(0, 0), size(0, 0) {} - Rect(vec2<T> position, vec2<T> size) : position(position), size(size) {} - - bool contains(vec2<T> point) const { - return point.x >= position.x && point.x <= position.x + size.x - && point.y >= position.y && point.y <= position.y + size.y; - } - - vec2<T> position; - vec2<T> size; - }; - - typedef Rect<int> IntRect; - typedef Rect<float> 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 <typename T> + class Rect { + public: + Rect() : position(0, 0), size(0, 0) {} + Rect(vec2<T> position, vec2<T> size) : position(position), size(size) {} + + bool contains(vec2<T> point) const { + return point.x >= position.x && point.x <= position.x + size.x + && point.y >= position.y && point.y <= position.y + size.y; + } + + vec2<T> position; + vec2<T> size; + }; + + typedef Rect<int> IntRect; + typedef Rect<float> FloatRect; +} + +#endif /* MGLPP_RECT_HPP */ |