|
TGUI_CONSTEXPR | Rect ()=default |
| Default constructor.
|
|
template<typename U > |
TGUI_CONSTEXPR | Rect (const Rect< U > &rect) |
| Constructs the rectangle from an another Rect with a different type.
|
|
TGUI_CONSTEXPR | Rect (sf::Rect< T > rect) |
| Constructs the rectangle from an sf::Rect.
|
|
TGUI_CONSTEXPR | Rect (T rectLeft, T rectTop, T rectWidth, T rectHeight) |
| Constructs the rectangle from its position and size.
|
|
TGUI_CONSTEXPR | Rect (Vector2< T > position, Vector2< T > size) |
| Constructs the rectangle from its position and size.
|
|
TGUI_CONSTEXPR void | setPosition (Vector2< T > position) |
| Sets the position of the rectangle.
|
|
TGUI_CONSTEXPR Vector2< T > | getPosition () const |
| Returns the position of the rectangle.
|
|
TGUI_CONSTEXPR void | setSize (Vector2< T > size) |
| Sets the size of the rectangle.
|
|
TGUI_CONSTEXPR Vector2< T > | getSize () const |
| Returns the size of the rectangle.
|
|
| operator sf::Rect< T > () const |
| Converts the Rect to an sf::Rect.
|
|
TGUI_CONSTEXPR bool | contains (const Vector2< T > &pos) const |
| Check if a point is inside the rectangle's area.
|
|
TGUI_CONSTEXPR bool | intersects (const Rect< T > &rect) const |
| Check the intersection between two rectangles.
|
|
|
T | left = 0 |
| Left coordinate of the rectangle.
|
|
T | top = 0 |
| Top coordinate of the rectangle.
|
|
T | width = 0 |
| Width of the rectangle.
|
|
T | height = 0 |
| Height of the rectangle.
|
|
◆ Rect() [1/5]
Default constructor.
Creates an empty rectangle (it is equivalent to calling Rect{0, 0, 0, 0}).
◆ Rect() [2/5]
template<typename T >
template<typename U >
Constructs the rectangle from an another Rect with a different type.
- Parameters
-
◆ Rect() [3/5]
template<typename T >
TGUI_CONSTEXPR tgui::Rect< T >::Rect |
( |
sf::Rect< T > |
rect | ) |
|
|
inlineexplicit |
Constructs the rectangle from an sf::Rect.
- Parameters
-
rect | Rectangle to initialize |
◆ Rect() [4/5]
template<typename T >
TGUI_CONSTEXPR tgui::Rect< T >::Rect |
( |
T |
rectLeft, |
|
|
T |
rectTop, |
|
|
T |
rectWidth, |
|
|
T |
rectHeight |
|
) |
| |
|
inline |
Constructs the rectangle from its position and size.
- Parameters
-
rectLeft | Left coordinate of the rectangle |
rectTop | Top coordinate of the rectangle |
rectWidth | Width of the rectangle |
rectHeight | Height of the rectangle |
◆ Rect() [5/5]
Constructs the rectangle from its position and size.
- Parameters
-
position | Position of the top-left corner of the rectangle |
size | Size of the rectangle |
◆ contains()
Check if a point is inside the rectangle's area.
This check is non-inclusive. If the point lies on the edge of the rectangle, this function will return false.
- Parameters
-
- Returns
- True if the point is inside, false otherwise
- Warning
- This code assumes the width and height are positive.
◆ getPosition()
Returns the position of the rectangle.
- Returns
- Rectangle position
◆ getSize()
Returns the size of the rectangle.
- Returns
- Rectangle size
◆ intersects()
template<typename T >
TGUI_CONSTEXPR bool tgui::Rect< T >::intersects |
( |
const Rect< T > & |
rect | ) |
const |
|
inline |
Check the intersection between two rectangles.
- Parameters
-
- Returns
- True if rectangles overlap, false otherwise
- Warning
- This code assumes the width and height of both rectangles are positive.
◆ setPosition()
Sets the position of the rectangle.
- Parameters
-
position | New position for the rectangle |
◆ setSize()
Sets the size of the rectangle.
- Parameters
-
size | New size for the rectangle |
The documentation for this class was generated from the following file: