Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
|
#include <rect.h>
Public Member Functions | |
Rect () | |
Rect (s16 x, s16 y, s32 width, s32 height) | |
Rect (const Rect &rect) | |
s16 | getX () const |
s16 | getY () const |
s32 | getWidth () const |
s32 | getHeight () const |
void | setX (s16 x) |
void | setY (s16 y) |
void | setWidth (s32 width) |
void | setHeight (s32 height) |
void | setX2 (s16 x2) |
void | setY2 (s16 y2) |
s16 | getX2 () const |
s16 | getY2 () const |
bool | hasDimensions () const |
void | getIntersect (const Rect &rect, Rect &dest) const |
void | getAddition (const Rect &rect, Rect &dest) const |
void | clipToIntersect (const Rect &rect) |
void | expandToInclude (const Rect &rect) |
bool | intersects (const Rect &rect) const |
bool | contains (s16 x, s16 y) const |
void | copyTo (Rect &dest) const |
bool | splitIntersection (const Rect &rect, Rect &intersection, WoopsiArray< Rect > *remainderRects) const |
Rect | operator& (const Rect &rect) |
Rect | operator+ (const Rect &rect) |
bool | operator== (const Rect &rect) |
bool | operator!= (const Rect &rect) |
Static Public Member Functions | |
static Rect | fromCoordinates (s16 x1, s16 y1, s16 x2, s16 y2) |
Public Attributes | |
s16 | x |
s16 | y |
s32 | width |
s32 | height |
Class describing a rectangle.
WoopsiUI::Rect::Rect | ( | ) |
Constructor.
WoopsiUI::Rect::Rect | ( | s16 | x, |
s16 | y, | ||
s32 | width, | ||
s32 | height | ||
) |
Constructor.
x | The x co-ordinate of the rect. |
y | The y co-ordinate of the rect. |
width | The width of the rect. |
height | The height of the rect. |
void WoopsiUI::Rect::clipToIntersect | ( | const Rect & | rect | ) |
Clips this rect to the region that intersects the supplied rect.
bool WoopsiUI::Rect::contains | ( | s16 | x, |
s16 | y | ||
) | const |
Check if the rect contains the supplied point.
x | X co-ord of the point. |
y | Y co-ord of the point. |
void WoopsiUI::Rect::copyTo | ( | Rect & | dest | ) | const |
Copy the properties of this rect to the destination rect.
dest | Destination rect to copy to. |
void WoopsiUI::Rect::expandToInclude | ( | const Rect & | rect | ) |
Expands this rect so that it includes the area described by the supplied rect.
static Rect WoopsiUI::Rect::fromCoordinates | ( | s16 | x1, |
s16 | y1, | ||
s16 | x2, | ||
s16 | y2 | ||
) | [static] |
Create a rect object from the supplied co-ordinates.
x1 | The x co-ordinate of the rect's top-left corner. |
y1 | The y co-ordinate of the rect's top-left corner. |
x2 | The x co-ordinate of the rect's bottom-right corner. |
y2 | The y co-ordinate of the rect's bottom-right corner. |
Populates dest with a rectangle representating the smallest rectangle that contains this rectangle and rect.
rect | The rectangle to add to this. |
dest | The destination rectangle. |
s32 WoopsiUI::Rect::getHeight | ( | ) | const [inline] |
Get the rect's height.
Populates dest with a rectangle representating the intersection of this rectangle and rect.
rect | The rectangle to intersect with this. |
dest | The destination rectangle. |
s32 WoopsiUI::Rect::getWidth | ( | ) | const [inline] |
Get the rect's width.
s16 WoopsiUI::Rect::getX | ( | ) | const [inline] |
Get the rect's x co-ordinate.
s16 WoopsiUI::Rect::getX2 | ( | ) | const [inline] |
Get the x co-ordinate of the rect's bottom-right corner.
s16 WoopsiUI::Rect::getY | ( | ) | const [inline] |
Get the rect's y co-ordinate.
s16 WoopsiUI::Rect::getY2 | ( | ) | const [inline] |
Get the y co-ordinate of the rect's bottom-right corner.
bool WoopsiUI::Rect::hasDimensions | ( | ) | const |
Determines if the rectangle has two dimensions; in other words, does it have both height and width? Negative width or height is considered not to be valid.
bool WoopsiUI::Rect::intersects | ( | const Rect & | rect | ) | const |
Check if the supplied rect intersects this.
rect | Rect to check for intersection with this. |
bool WoopsiUI::Rect::operator!= | ( | const Rect & | rect | ) |
Overloaded != operator. Checks if the dimensions of the supplied rect are not the same as this rect.
rect | The rect to compare with this. |
Overloaded & operator. Returns the intersect of this rectangle and the rectangle passed as the "rect" argument".
rect | The rectangle to intersect with this. |
Overloaded + operator. Returns the smallest rectangle that can contain this rectangle and the rectangle passed as the "rect" argument.
rect | The rectangle to add to this. |
bool WoopsiUI::Rect::operator== | ( | const Rect & | rect | ) |
Overloaded == operator. Checks if the dimensions of the supplied rect are the same as this rect.
rect | The rect to compare with this. |
void WoopsiUI::Rect::setHeight | ( | s32 | height | ) | [inline] |
Set the rect's height.
height | The new height. |
void WoopsiUI::Rect::setWidth | ( | s32 | width | ) | [inline] |
Set the rect's width.
width | The new width. |
void WoopsiUI::Rect::setX | ( | s16 | x | ) | [inline] |
Set the rect's x co-ordinate.
x | The new x co-ordinate. |
void WoopsiUI::Rect::setX2 | ( | s16 | x2 | ) |
Set the x co-ordinate of the rect's bottom-right corner. If x2 is less than the rect's current x co-ordinate the method automatically adjusts the co-ords so that the rect's width is never negative. Changing this property will change the width of the rect.
x2 | The x co-ordinate of the rect's bottom-right corner. |
void WoopsiUI::Rect::setY | ( | s16 | y | ) | [inline] |
Set the rect's y co-ordinate.
y | The new y co-ordinate. |
void WoopsiUI::Rect::setY2 | ( | s16 | y2 | ) |
Set the y co-ordinate of the rect's bottom-right corner. If y2 is less than the rect's current y co-ordinate the method automatically adjusts the co-ords so that the rect's height is never negative. Changing this property will change the height of the rect.
y2 | The y co-ordinate of the rect's bottom-right corner. |
bool WoopsiUI::Rect::splitIntersection | ( | const Rect & | rect, |
Rect & | intersection, | ||
WoopsiArray< Rect > * | remainderRects | ||
) | const |
Determines if the supplied rect intersects this and, if so, divides the supplied rect into the intersected region (stored in "intersection") and the rectangular regions that do not intersect (stored in "remainderRects").
rect | Rectangle to check for intersection. |
intersection | Will contain the dimensions of the intersect once the function ends. |
remainderRects | Will contain the list of non-intersecting regions of rect. |
Height of the rectangle.
Width of the rectangle.
X co-ordinate of the rectangle.
Y co-ordinate of the rectangle.