Class defining a 2D rectangle with top-left corner coordinates and width/height in pixels. More...
Functions | |
Rect (size_t x_=0, size_t y_=0, size_t w_=0, size_t h_=0) | |
Default constructor. More... | |
size_t | area () |
Returns the area of the rectangle. More... | |
bool | operator== (const Rect &that) const |
Tests if the given sl::Rect has the same properties. More... | |
bool | operator!= (const Rect &that) const |
Tests if the given sl::Rect has different properties. More... | |
bool | isEmpty () const |
Tests if the given sl::Rect is empty (width or/and height is null). More... | |
bool | contains (const Rect &target, bool proper=false) const |
Tests if this sl::Rect contains the target sl::Rect. More... | |
bool | isContained (const Rect &target, bool proper=false) const |
Tests if this sl::Rect is contained inside the given target sl::Rect. More... | |
bool | isContained (const Resolution &resolution, bool proper=false) const |
Overloaded method of isContained(). Tests if this sl::Rect is contained inside a given sl::Resolution. More... | |
Attributes | |
size_t | x |
x coordinates of top-left corner. More... | |
size_t | y |
y coordinates of top-left corner. More... | |
size_t | width |
Width of the rectangle in pixels. More... | |
size_t | height |
Height of the rectangle in pixels. More... | |
Class defining a 2D rectangle with top-left corner coordinates and width/height in pixels.
|
inline |
Default constructor.
|
inline |
Returns the area of the rectangle.
|
inline |
Tests if the given sl::Rect has the same properties.
|
inline |
Tests if the given sl::Rect has different properties.
|
inline |
Tests if the given sl::Rect is empty (width or/and height is null).
|
inline |
|
inline |
|
inline |
Overloaded method of isContained(). Tests if this sl::Rect is contained inside a given sl::Resolution.
It tests if the current rectangle is contained inside a sl::Rect defined by Rect(0, 0, resolution.width, resolution.height).
size_t x |
x coordinates of top-left corner.
Referenced by Rect::contains(), Rect::isContained(), Rect::operator!=(), and Rect::operator==().
size_t y |
y coordinates of top-left corner.
Referenced by Rect::contains(), Rect::isContained(), Rect::operator!=(), and Rect::operator==().
size_t width |
Width of the rectangle in pixels.
Referenced by Rect::contains(), Rect::isContained(), Rect::operator!=(), and Rect::operator==().
size_t height |
Height of the rectangle in pixels.
Referenced by Rect::contains(), Rect::isContained(), Rect::operator!=(), and Rect::operator==().