8#ifndef GALAXY_MATH_RECT_HPP_
9#define GALAXY_MATH_RECT_HPP_
13#include <glm/vec2.hpp>
14#include <SDL3/SDL_rect.h>
25 template<meta::is_arithmetic Type>
42 Rect(const Type x, const Type y, const Type width, const Type height) noexcept;
58 bool contains(const Type _x, const Type _y) const noexcept;
95 void set_top_left(const glm::vec<2, Type, glm::defaultp>& pos) noexcept;
127 glm::vec<2, Type, glm::defaultp>
get_center() const noexcept;
135 glm::vec<2, Type, glm::defaultp>
get_size() const noexcept;
149 auto operator<=>(const
Rect&) const noexcept = default;
197 template<
meta::is_arithmetic Type>
206 template<meta::is_arithmetic Type>
207 inline Rect<Type>::Rect(
const Type x,
const Type y,
const Type width,
const Type height) noexcept
215 template<meta::is_arithmetic Type>
220 template<meta::is_arithmetic Type>
227 template<meta::is_arithmetic Type>
233 template<meta::is_arithmetic Type>
243 template<meta::is_arithmetic Type>
249 template<meta::is_arithmetic Type>
256 template<meta::is_arithmetic Type>
262 template<meta::is_arithmetic Type>
268 template<meta::is_arithmetic Type>
274 template<meta::is_arithmetic Type>
280 template<meta::is_arithmetic Type>
286 template<meta::is_arithmetic Type>
293 template<meta::is_arithmetic Type>
297 return (value >= min) && (value <= max);
Represents a rectangle object.
bool intersects(const Rect< Type > &b) const noexcept
bool contains(const Type _x, const Type _y) const noexcept
bool overlaps(const Rect< Type > &b) noexcept
void set_top_left(const glm::vec< 2, Type, glm::defaultp > &pos) noexcept
Type get_right() const noexcept
bool value_in_range(const Type value, const Type min, const Type max) noexcept
glm::vec< 2, Type, glm::defaultp > get_size() const noexcept
~Rect() noexcept
Destructor.
glm::vec< 2, Type, glm::defaultp > get_top_left() const noexcept
SDL_Rect to_sdl() noexcept
Type get_bottom() const noexcept
glm::vec< 2, Type, glm::defaultp > get_center() const noexcept
Rect() noexcept
Constructor.
Rect< int > iRect
Type definition for an int rectangle.
Rect< float > fRect
Type definition for a floating point rectangle.