diff options
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 */ |