5 #ifndef __IRR_RECT_H_INCLUDED__ 6 #define __IRR_RECT_H_INCLUDED__ 38 rect(
const position2d<T>& upperLeft,
const position2d<T>& lowerRight)
91 bool operator<(const rect<T>& other)
const 93 return getArea() < other.getArea();
225 return position2d<T>(
rect(T x, T y, T x2, T y2)
Constructor with two corners.
rect(const position2d< T > &pos, const dimension2d< U > &size)
Constructor with upper left corner and dimension.
rect()
Default constructor creating empty rectangle at (0,0)
rect< s32 > recti
Rectangle with int values.
bool operator!=(const rect< T > &other) const
inequality operator
position2d< T > UpperLeftCorner
Upper left corner.
bool isValid() const
Returns if the rect is valid to draw.
Everything in the Irrlicht Engine can be found in this namespace.
Specifies a 2 dimensional size.
bool constrainTo(const rect< T > &other)
Moves this rectangle to fit inside another one.
position2d< T > LowerRightCorner
Lower right corner.
rect< T > operator+(const position2d< T > &pos) const
move right by given numbers
bool isRectCollided(const rect< T > &other) const
Check if the rectangle collides with another rectangle.
dimension2d< T > getSize() const
Get the dimensions of the rectangle.
T getHeight() const
Get height of rectangle.
rect< T > & operator-=(const position2d< T > &pos)
move left by given numbers
T getWidth() const
Get width of rectangle.
position2d< T > getCenter() const
Get the center of the rectangle.
bool isPointInside(const position2d< T > &pos) const
Returns if a 2d point is within this rectangle.
rect(const position2d< T > &upperLeft, const position2d< T > &lowerRight)
Constructor with two corners.
void clipAgainst(const rect< T > &other)
Clips this rectangle with another one.
void addInternalPoint(const position2d< T > &p)
Adds a point to the rectangle.
rect< T > & operator+=(const position2d< T > &pos)
move right by given numbers
void addInternalPoint(T x, T y)
Adds a point to the bounding rectangle.
rect< T > operator-(const position2d< T > &pos) const
move left by given numbers
bool operator==(const rect< T > &other) const
equality operator
rect< f32 > rectf
Rectangle with float values.
void repair()
If the lower right corner of the rect is smaller then the upper left, the points are swapped...
T getArea() const
Returns size of rectangle.