Rect is an utility class for manipulating rectangles. More...
#include <Rect.hpp>
Public Member Functions | |
Rect () | |
Default constructor. | |
Rect (T left, T top, T right, T bottom) | |
Construct the rectangle from its coordinates. | |
Vector2< T > | GetSize () const |
Get the size of the rectangle. | |
Vector2< T > | GetCenter () const |
Get the center of the rectangle. | |
void | Offset (T offsetX, T offsetY) |
Move the whole rectangle by the given offset. | |
void | Offset (const Vector2< T > &offset) |
Move the whole rectangle by the given offset. | |
bool | Contains (T x, T y) const |
Check if a point is inside the rectangle's area. | |
bool | Contains (const Vector2< T > &point) const |
Check if a point is inside the rectangle's area. | |
bool | Intersects (const Rect< T > &rectangle) const |
Check intersection between two rectangles. | |
bool | Intersects (const Rect< T > &rectangle, Rect< T > &intersection) const |
Check intersection between two rectangles and return the resulting rectangle. | |
Public Attributes | |
T | Left |
Left coordinate of the rectangle. | |
T | Top |
Top coordinate of the rectangle. | |
T | Right |
Right coordinate of the rectangle. | |
T | Bottom |
Bottom coordinate of the rectangle. |
Rect is an utility class for manipulating rectangles.
Template parameter defines the type of coordinates (integer, float, ...)
Definition at line 42 of file Rect.hpp.
Construct the rectangle from its coordinates.
left | : Left coordinate of the rectangle | |
top | : Top coordinate of the rectangle | |
right | : Right coordinate of the rectangle | |
bottom | : Bottom coordinate of the rectangle |
Check if a point is inside the rectangle's area.
point | : Point to test |
bool sf::Rect< T >::Contains | ( | T | x, | |
T | y | |||
) | const |
Check if a point is inside the rectangle's area.
x | : X coordinate of the point to test | |
y | : Y coordinate of the point to test |
Get the center of the rectangle.
Get the size of the rectangle.
bool sf::Rect< T >::Intersects | ( | const Rect< T > & | rectangle, | |
Rect< T > & | intersection | |||
) | const |
Check intersection between two rectangles and return the resulting rectangle.
rectangle | : Rectangle to test | |
intersection | : Rectangle to be filled with the intersection of both rectangles |
Check intersection between two rectangles.
rectangle | : Rectangle to test |
Move the whole rectangle by the given offset.
offset | : Offset to apply to the current position |
void sf::Rect< T >::Offset | ( | T | offsetX, | |
T | offsetY | |||
) |
Move the whole rectangle by the given offset.
offsetX | : Horizontal offset | |
offsetY | : Vertical offset |