29#include <TGUI/Vector2.hpp>
31#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
32 #include <SFML/Graphics/Rect.hpp>
49 TGUI_CONSTEXPR
Rect() =
default;
60 top {static_cast<T>(rect.
top)},
66#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
72 explicit TGUI_CONSTEXPR
Rect(sf::Rect<T> rect) :
89 TGUI_CONSTEXPR
Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) :
158#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
162 explicit operator sf::Rect<T>()
const
197 const T interLeft = std::max(
left, rect.
left);
198 const T interTop = std::max(
top, rect.
top);
203 return (interLeft < interRight) && (interTop < interBottom);
220 template <
typename T>
231 template <
typename T>
234 return !(left == right);
240 using FloatRect = Rect<float>;
241 using IntRect = Rect<int>;
242 using UIntRect = Rect<unsigned int>;
TGUI_CONSTEXPR Rect()=default
Default constructor.
TGUI_CONSTEXPR Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight)
Constructs the rectangle from its position and size.
Definition: Rect.hpp:89
TGUI_CONSTEXPR Rect(Vector2< T > position, Vector2< T > size)
Constructs the rectangle from its position and size.
Definition: Rect.hpp:104
T width
Width of the rectangle.
Definition: Rect.hpp:212
TGUI_CONSTEXPR Vector2< T > getSize() const
Returns the size of the rectangle.
Definition: Rect.hpp:153
T height
Height of the rectangle.
Definition: Rect.hpp:213
TGUI_CONSTEXPR Rect(sf::Rect< T > rect)
Constructs the rectangle from an sf::Rect.
Definition: Rect.hpp:72
TGUI_CONSTEXPR Vector2< T > getPosition() const
Returns the position of the rectangle.
Definition: Rect.hpp:130
TGUI_CONSTEXPR void setPosition(Vector2< T > position)
Sets the position of the rectangle.
Definition: Rect.hpp:118
T left
Left coordinate of the rectangle.
Definition: Rect.hpp:210
T top
Top coordinate of the rectangle.
Definition: Rect.hpp:211
TGUI_CONSTEXPR Rect(const Rect< U > &rect)
Constructs the rectangle from an another Rect with a different type.
Definition: Rect.hpp:58
TGUI_CONSTEXPR bool contains(const Vector2< T > &pos) const
Check if a point is inside the rectangle's area.
Definition: Rect.hpp:179
TGUI_CONSTEXPR bool intersects(const Rect< T > &rect) const
Check the intersection between two rectangles.
Definition: Rect.hpp:194
TGUI_CONSTEXPR void setSize(Vector2< T > size)
Sets the size of the rectangle.
Definition: Rect.hpp:141
Definition: Vector2.hpp:42
T y
Y coordinate of the vector.
Definition: Vector2.hpp:142
T x
X coordinate of the vector.
Definition: Vector2.hpp:141
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36