28#include <TGUI/Vector2.hpp>
30#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
31 #include <SFML/Graphics/Rect.hpp>
36TGUI_MODULE_EXPORT
namespace tgui
48 constexpr Rect() =
default;
58 top {static_cast<T>(rect.
top)},
64#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
70 explicit constexpr Rect(sf::Rect<T> rect) :
87 constexpr Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) :
151#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
155 explicit operator sf::Rect<T>()
const
189 const T interLeft = std::max(
left, rect.
left);
190 const T interTop = std::max(
top, rect.
top);
195 return (interLeft < interRight) && (interTop < interBottom);
210 template <
typename T>
211 TGUI_NODISCARD
constexpr bool operator==(
const Rect<T>& left,
const Rect<T>& right)
220 template <
typename T>
221 TGUI_NODISCARD
constexpr bool operator!=(
const Rect<T>& left,
const Rect<T>& right)
223 return !(left == right);
228 using FloatRect = Rect<float>;
229 using IntRect = Rect<int>;
230 using UIntRect = Rect<unsigned int>;
constexpr Rect()=default
Default constructor.
T width
Width of the rectangle.
Definition Rect.hpp:203
T height
Height of the rectangle.
Definition Rect.hpp:204
constexpr Rect(sf::Rect< T > rect)
Constructs the rectangle from an sf::Rect.
Definition Rect.hpp:70
constexpr bool intersects(const Rect< T > &rect) const
Check the intersection between two rectangles.
Definition Rect.hpp:186
constexpr Vector2< T > getSize() const
Returns the size of the rectangle.
Definition Rect.hpp:146
constexpr Rect(const Rect< U > &rect)
Constructs the rectangle from an another Rect with a different type.
Definition Rect.hpp:56
T left
Left coordinate of the rectangle.
Definition Rect.hpp:201
constexpr void setPosition(Vector2< T > position)
Sets the position of the rectangle.
Definition Rect.hpp:114
constexpr Vector2< T > getPosition() const
Returns the position of the rectangle.
Definition Rect.hpp:125
constexpr bool contains(const Vector2< T > &pos) const
Check if a point is inside the rectangle's area.
Definition Rect.hpp:172
T top
Top coordinate of the rectangle.
Definition Rect.hpp:202
constexpr void setSize(Vector2< T > size)
Sets the size of the rectangle.
Definition Rect.hpp:135
constexpr Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight)
Constructs the rectangle from its position and size.
Definition Rect.hpp:87
constexpr Rect(Vector2< T > position, Vector2< T > size)
Constructs the rectangle from its position and size.
Definition Rect.hpp:101
Definition Vector2.hpp:41
T y
Y coordinate of the vector.
Definition Vector2.hpp:136
T x
X coordinate of the vector.
Definition Vector2.hpp:135
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38