|
| constexpr | Rect ()=default |
| | Default constructor.
|
| |
| template<typename U > |
| constexpr | Rect (const Rect< U > &rect) |
| | Constructs the rectangle from an another Rect with a different type.
|
| |
| constexpr | Rect (sf::Rect< T > rect) |
| | Constructs the rectangle from an sf::Rect.
|
| |
| constexpr | Rect (T rectLeft, T rectTop, T rectWidth, T rectHeight) |
| | Constructs the rectangle from its position and size.
|
| |
| constexpr | Rect (Vector2< T > position, Vector2< T > size) |
| | Constructs the rectangle from its position and size.
|
| |
| constexpr void | setPosition (Vector2< T > position) |
| | Sets the position of the rectangle.
|
| |
| TGUI_NODISCARD constexpr Vector2< T > | getPosition () const |
| | Returns the position of the rectangle.
|
| |
| constexpr void | setSize (Vector2< T > size) |
| | Sets the size of the rectangle.
|
| |
| TGUI_NODISCARD constexpr Vector2< T > | getSize () const |
| | Returns the size of the rectangle.
|
| |
|
| operator sf::Rect< T > () const |
| | Converts the Rect to an sf::Rect.
|
| |
| TGUI_NODISCARD constexpr bool | contains (const Vector2< T > &pos) const |
| | Check if a point is inside the rectangle's area.
|
| |
| TGUI_NODISCARD 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 >
| constexpr tgui::Rect< T >::Rect |
( |
sf::Rect< T > | rect | ) |
|
|
inlineexplicitconstexpr |
Constructs the rectangle from an sf::Rect.
- Parameters
-
| rect | Rectangle to initialize |
◆ Rect() [4/5]
template<typename T >
| constexpr tgui::Rect< T >::Rect |
( |
T | rectLeft, |
|
|
T | rectTop, |
|
|
T | rectWidth, |
|
|
T | rectHeight ) |
|
inlineconstexpr |
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()
template<typename T >
| TGUI_NODISCARD constexpr bool tgui::Rect< T >::contains |
( |
const Vector2< T > & | pos | ) |
const |
|
inlineconstexpr |
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_NODISCARD constexpr bool tgui::Rect< T >::intersects |
( |
const Rect< T > & | rect | ) |
const |
|
inlineconstexpr |
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: