17 QX_PUSH_SUPPRESS_ALL_WARNINGS();
18 #include <glm/vec2.hpp>
19 QX_POP_SUPPRESS_WARNINGS();
33 template<
class vector_t>
37 using vector_type = vector_t;
38 using value_type =
typename vector_type::value_type;
50 constexpr
explicit basic_rect(vector_t
size, vector_t
pos = vector_t(value_type(0.f))) noexcept;
62 value_type xPos = value_type(0.f),
63 value_type yPos = value_type(0.f)) noexcept;
69 constexpr
void expand(
const vector_t& dSize) noexcept;
75 constexpr
void contract(
const vector_t& dSize) noexcept;
87 constexpr
void set_pos(
const vector_t&
pos) noexcept;
93 constexpr
void shift(
const vector_t& dPos) noexcept;
99 constexpr
const vector_t&
pos()
const noexcept;
106 constexpr
const vector_t&
min()
const noexcept;
112 constexpr vector_t
max()
const noexcept;
118 constexpr
const vector_t&
size()
const noexcept;
124 constexpr value_type
width()
const noexcept;
130 constexpr value_type
height()
const noexcept;
136 constexpr value_type
left()
const noexcept;
142 constexpr value_type
right()
const noexcept;
148 constexpr value_type
top()
const noexcept;
154 constexpr value_type
bottom()
const noexcept;
160 constexpr vector_t
center()
const noexcept;
166 constexpr
bool empty()
const noexcept;
172 constexpr value_type
area()
const noexcept;
180 constexpr
bool contains(
const vector_t&
pos,
const vector_t& originPos = vector_t(0.f))
const noexcept;
188 constexpr
bool contains(
const basic_rect& other,
const vector_t& originPos = vector_t(0.f))
const noexcept;
202 constexpr std::optional<basic_rect>
overlap(
const basic_rect& other)
const noexcept;
204 constexpr
bool operator==(
const basic_rect& other)
const noexcept;
205 constexpr
bool operator!=(
const basic_rect& other)
const noexcept;
212 constexpr
void check_and_assign_size(
const vector_t&
size) noexcept;
215 vector_t m_Size = vector_t(0.f);
216 vector_t m_Pos = vector_t(0.f);
constexpr void shift(const vector_t &dPos) noexcept
Shift rect position.
constexpr value_type width() const noexcept
Get rect width.
constexpr vector_t center() const noexcept
Get rect center pos.
constexpr value_type height() const noexcept
Get rect height.
constexpr void set_pos(const vector_t &pos) noexcept
Set rect position.
constexpr value_type bottom() const noexcept
rect bottom border coordinate (y)
constexpr value_type top() const noexcept
rect top border coordinate (y)
constexpr bool empty() const noexcept
Is rect empty.
constexpr void contract(const vector_t &dSize) noexcept
Contract rect.
constexpr const vector_t & min() const noexcept
Get min rect pos.
constexpr std::optional< basic_rect > overlap(const basic_rect &other) const noexcept
Get rect representing overlap this rect by other rect.
constexpr value_type area() const noexcept
Calc rect area.
constexpr value_type right() const noexcept
rect right border coordinate (x)
constexpr value_type left() const noexcept
Get rect left border coordinate (x)
constexpr void set_size(const vector_t &size) noexcept
Change rect size.
constexpr bool overlaps(const basic_rect &other) const noexcept
Is this rect overlaps other rect.
constexpr const vector_t & pos() const noexcept
Get upper left corner pos.
constexpr vector_t max() const noexcept
Get max rect pos.
constexpr const vector_t & size() const noexcept
Get rect size.
constexpr bool contains(const vector_t &pos, const vector_t &originPos=vector_t(0.f)) const noexcept
Is point inside rect.
constexpr void expand(const vector_t &dSize) noexcept
Expand rect.