#include <ZE_ZRect.h>
Public Member Functions | |
ZRect () | |
Default constructor for ZRect. | |
ZRect (float x, float y, float width, float height) | |
Constructor for ZRect that takes inital values. | |
ZRect (const SDL_Rect &rect) | |
Constructor for ZRect that uses an SDL_Rect. | |
ZRect (const ZRect &rhs) | |
Copy constructor for ZRect. | |
virtual | ~ZRect () |
Virtual Destructor. | |
const ZRect & | operator= (const ZRect &rhs) |
Overload for = operator with ZRect. | |
bool | operator< (const ZRect &rhs) const |
Overload for < operator with ZRect, based upon location then size. | |
void | Draw (Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255) const |
Draw rectangle. (filled). | |
void | Move (float x, float y) |
Changes the location of the rectangle. | |
void | MoveRel (float xMove, float yMove) |
Changes the location of the rectangle based upon the current location. | |
void | Resize (float width, float height) |
Resize rectangle. | |
void | ResizeRel (float widthChange, float heightChange) |
Grows or shrinks current rectangle. | |
bool | Intersects (const ZRect &rect) const |
Check if one ZRect intersects another. | |
bool | Contains (float x, float y) const |
Check if a rectangle contains a given point. | |
bool | Contains (const ZRect &rect) const |
Check if a rectangle contains a given point. | |
ZRect | Intersection (const ZRect &rect) const |
Finds intersection of two rectangles. | |
SDL_Rect | SDLrect () const |
Returns an SDL_Rect representing the rectangle. | |
float | X () const |
Returns X Location. | |
float | Y () const |
Returns Y Location. | |
float | Left () const |
Return position of left side. | |
float | Right () const |
Return position of right side. | |
float | Top () const |
Return position of top side. | |
float | Bottom () const |
Return position of bottom side. | |
float | Width () const |
Returns Width. | |
float | Height () const |
Returns Height. | |
Protected Attributes | |
ZEngine * | rEngine |
Pointer to ZEngine Object. | |
float | rX |
X Position of top left corner of rectangle. | |
float | rY |
Y Position of top left corner of rectangle. | |
float | rWidth |
Width of Rectangle. | |
float | rHeight |
Height of Rectangle. |
|
Default constructor, initializes all values to zero. |
|
Constructor for ZRect that takes inital values for all four members.
|
|
Constructor for ZRect that initializes from an SDL_Rect.
|
|
Takes a ZRect and constructs a new identical rectangle.
|
|
Virtual destructor making future inheritance safe. |
|
Copies all values from one ZRect into another.
|
|
Rectangles are sorted by y value, followed by x value, if they start at the same place, the smaller of the two is deemed less than the other.
|
|
Draw the ZRect, this function is mainly provided for testing purposes.
|
|
Changes the current x,y position of the rectangle.
|
|
Changes the current x,y position of the rectangle relative to the current location.
|
|
Changes the current width and height of the rectangle.
|
|
Changes the current width and height of the rectangle based upon current values.
|
|
Checks for overlap and returns boolean value based on if overlap exists.
|
|
Checks point against boundaries of rectangle and returns result.
|
|
Checks point against boundaries of rectangle and returns result.
|
|
Checks for intersection, and returns rectangle where the two rectangles intersect.
|
|
Makes a SDL_Rect representing the rectangle, for use where functions require an SDL_Rect.
|
|
Access private X location member.
|
|
Access private Y location member.
|
|
Find X position of left side of rectangle.
|
|
Find X position of right side of rectangle.
|
|
Find Y position of top side of rectangle.
|
|
Find Y position of left side of rectangle.
|
|
Access private width member.
|
|
Access private height member.
|