|
|
| rect () |
| | Default constructor creating empty rectangle at (0,0).
|
|
| rect (T x, T y, T x2, T y2) |
| | Constructor with two corners.
|
|
| rect (const position2d< T > &upperLeft, const position2d< T > &lowerRight) |
| | Constructor with two corners.
|
|
template<class U> |
| | rect (const position2d< T > &pos, const dimension2d< U > &size) |
| | Constructor with upper left corner and dimension.
|
|
rect< T > | operator+ (const position2d< T > &pos) const |
| | move right by given numbers
|
|
rect< T > & | operator+= (const position2d< T > &pos) |
| | move right by given numbers
|
|
rect< T > | operator- (const position2d< T > &pos) const |
| | move left by given numbers
|
|
rect< T > & | operator-= (const position2d< T > &pos) |
| | move left by given numbers
|
|
bool | operator== (const rect< T > &other) const |
| | equality operator
|
|
bool | operator!= (const rect< T > &other) const |
| | inequality operator
|
|
bool | operator< (const rect< T > &other) const |
| | compares size of rectangles
|
|
T | getArea () const |
| | Returns size of rectangle.
|
| bool | isPointInside (const position2d< T > &pos) const |
| | Returns if a 2d point is within this rectangle.
|
| bool | isRectCollided (const rect< T > &other) const |
| | Check if the rectangle collides with another rectangle.
|
| void | clipAgainst (const rect< T > &other) |
| | Clips this rectangle with another one.
|
| bool | constrainTo (const rect< T > &other) |
| | Moves this rectangle to fit inside another one.
|
|
T | getWidth () const |
| | Get width of rectangle.
|
|
T | getHeight () const |
| | Get height of rectangle.
|
|
void | repair () |
| | If the lower right corner of the rect is smaller then the upper left, the points are swapped.
|
| bool | isValid () const |
| | Returns if the rect is valid to draw.
|
|
position2d< T > | getCenter () const |
| | Get the center of the rectangle.
|
|
dimension2d< T > | getSize () const |
| | Get the dimensions of the rectangle.
|
| void | addInternalPoint (const position2d< T > &p) |
| | Adds a point to the rectangle.
|
| void | addInternalPoint (T x, T y) |
| | Adds a point to the bounding rectangle.
|
template<class T>
class irr::core::rect< T >
Rectangle template.
Mostly used by 2D GUI elements and for 2D drawing methods. It has 2 positions instead of position and dimension and a fast method for collision detection with other rectangles and points.
Coordinates are (0,0) for top-left corner, and increasing to the right and to the bottom.