|
GlistEngine
|
#include <gRect.h>
Public Member Functions | |
| gRect () | |
| gRect (int left, int top, int right, int bottom) | |
| gRect (const gRect &r) | |
| virtual | ~gRect () |
| int | centerX () const |
| int | centerY () const |
| float | exactCenterX () const |
| float | exactCenterY () const |
| void | set (int left, int top, int right, int bottom) |
| void | set (const gRect &r) |
| bool | intersects (int left, int top, int right, int bottom) const |
| bool | intersects (const gRect &r) const |
| bool | contains (int left, int top, int right, int bottom) const |
| bool | contains (const gRect &r) const |
| bool | contains (int x, int y) const |
| int | left () const |
| int | top () const |
| int | right () const |
| int | bottom () const |
| int | getWidth () const |
| int | getHeight () const |
| void | moveX (int speedX) |
| void | moveY (int speedY) |
| void | moveX (float speedX) |
| void | moveY (float speedY) |
Static Public Member Functions | |
| static bool | intersects (int left1, int top1, int right1, int bottom1, int left2, int top2, int right2, int bottom2) |
| static bool | intersects (const gRect &r1, const gRect &r2) |
| static bool | contains (int left1, int top1, int right1, int bottom1, int left2, int top2, int right2, int bottom2) |
| static bool | contains (const gRect &r1, const gRect &r2) |
gRect holds six integer for a rectangle. The rectangle is represented by the coordinates of its four edges(left, top, right, bottom). These fields can be accessed via their respective functions(e.g. to acces left edge of the rectangle use left()). Use getWidth() and getHeight() to retrieve the rectangles width and height. To set edges of the rectangle use one of the set function.
| gRect::gRect | ( | ) |
Creates empty rectangle
| gRect::gRect | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom | ||
| ) |
Creates rectangle with given edges.
| left | Left edge of the rectangle to be created. |
| top | Top edge of the rectangle to be created. |
| right | Right edge of the rectangle to be created. |
| bottom | Bottom edge of the rectangle to be created. |
| gRect::gRect | ( | const gRect & | r | ) |
Creates copy of the given rectangle.
| r | Rectangle to be copied. |
|
virtual |
| int gRect::bottom | ( | ) | const |
Returns bottom edge of the rectangle.
| int gRect::centerX | ( | ) | const |
Returns x(horizontal) center coordinate of rectangle but as integer value.
| int gRect::centerY | ( | ) | const |
Returns y(vertical) center coordinate of rectangle but as integer value.
| bool gRect::contains | ( | const gRect & | r | ) | const |
Checks if given rectangles edges are inside or equal of the current rectangle.
| r | Rectangle to be check. |
Checks if second rectangles edges are inside or equal of the first rectangle.
| r1 | First rectangle to be check. |
| r2 | Second rectangle to be check. |
| bool gRect::contains | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom | ||
| ) | const |
Checks if given rectangles edges are inside or equal of the current rectangle.
| left | Left edge of the given rectangle |
| top | Top edge of the given rectangle |
| right | Right edge of the given rectangle |
| bottom | Bottom edge of the given rectangle |
|
static |
Checks if second rectangles edges are inside or equal of the first rectangle.
| left1 | Left edge of the first rectangle |
| top1 | Top edge of the first rectangle |
| right1 | Right edge of the first rectangle |
| bottom1 | Bottom edge of the first rectangle |
| left2 | Left edge of the second rectangle |
| top2 | Top edge of the second rectangle |
| right2 | Right edge of the second rectangle |
| bottom2 | Bottom edge of the second rectangle |
| bool gRect::contains | ( | int | x, |
| int | y | ||
| ) | const |
Checks if given point are inside of the current rectangle.
| x | X Position of the given point |
| y | Y Position of the given point |
| float gRect::exactCenterX | ( | ) | const |
Returns x(horizontal) exact center coordinate of rectangle as float value.
| float gRect::exactCenterY | ( | ) | const |
Returns y(vertical) exact center coordinate of rectangle as float value.
| int gRect::getHeight | ( | ) | const |
Returns height of the rectangle.
| int gRect::getWidth | ( | ) | const |
Returns width of the rectangle.
| bool gRect::intersects | ( | const gRect & | r | ) | const |
Checks whether of intersection with given rectangle.
| r | Rectangle to be check. |
Checks whether of intersection given 2 rectangle.
| r1 | First rectangle to be check. |
| r2 | Second rectangle to be check. |
| bool gRect::intersects | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom | ||
| ) | const |
Checks whether of intersection with given rectangle.
| left | Left edge of the given rectangle |
| top | Top edge of the given rectangle |
| right | Right edge of the given rectangle |
| bottom | Bottom edge of the given rectangle |
|
static |
Checks whether of intersection given 2 rectangle.
| left1 | Left edge of the first rectangle |
| top1 | Top edge of the first rectangle |
| right1 | Right edge of the first rectangle |
| bottom1 | Bottom edge of the first rectangle |
| left2 | Left edge of the second rectangle |
| top2 | Top edge of the second rectangle |
| right2 | Right edge of the second rectangle |
| bottom2 | Bottom edge of the second rectangle |
| int gRect::left | ( | ) | const |
Returns left edge of the rectangle.
| void gRect::moveX | ( | float | speedX | ) |
Move the rectangle on X Axis with amound of speedX
| void gRect::moveX | ( | int | speedX | ) |
Move the rectangle on X Axis with amound of speedX
| void gRect::moveY | ( | float | speedY | ) |
Move the rectangle on Y Axis with amound of speedY
| void gRect::moveY | ( | int | speedY | ) |
Move the rectangle on Y Axis with amound of speedY
| int gRect::right | ( | ) | const |
Returns right edge of the rectangle.
| void gRect::set | ( | const gRect & | r | ) |
Sets edges of the rectangle with the given rectangle
| r | Rectangle to be set |
| void gRect::set | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom | ||
| ) |
Sets edges of the rectangle.
| left | Left edge to be set |
| top | Top edge to be set |
| right | Right edge to be set |
| bottom | Bottom edge to be set |
| int gRect::top | ( | ) | const |
Returns top edge of the rectangle.