![]() |
Gorgon Game Engine
|
Represents a rectangle in a 2D space. More...
Public Types | |
| typedef T_ | BaseType |
| Base type of the rectangle elements. More... | |
Public Member Functions | |
| basic_Rectangle () | |
| Default constructor, does not initialize stored values. More... | |
| template<class O_ > | |
| basic_Rectangle (const basic_Bounds< O_ > &bounds) | |
| Converting constructor from bounds. More... | |
| basic_Rectangle (const basic_Point< T_ > &position, const basic_Size< T_ > &size) | |
| Filling constructor using values for top left corner and size. More... | |
| basic_Rectangle (const basic_Point< T_ > &position, T_ width, T_ height) | |
| Filling constructor using values for top left corner and size. More... | |
| basic_Rectangle (const basic_Point< T_ > &topleft, const basic_Point< T_ > &bottomright) | |
| Filling constructor using values for top left and bottom right corners. More... | |
| template<class O_ > | |
| basic_Rectangle (const basic_Rectangle< O_ > &rect) | |
| Converting constructor from a different typed rectangle. More... | |
| basic_Rectangle (const std::string &str) | |
| Conversion from string. More... | |
| basic_Rectangle (const T_ &left, const T_ &top, const basic_Size< T_ > &size) | |
| Filling constructor using values for top left corner and size. More... | |
| basic_Rectangle (const T_ &left, const T_ &top, const T_ &width, const T_ &height) | |
| Filling constructor using values for top left corner and size. More... | |
| T_ | Bottom () const |
| Calculates and returns the bottommost coordinate. More... | |
| basic_Point< T_ > | BottomLeft () const |
| Returns the bottom left coordinates of the rectangle. More... | |
| basic_Point< T_ > | BottomRight () const |
| Returns the bottom right coordinates of the rectangle. More... | |
| basic_Point< T_ > | Center () const |
| Returns the center point of the rectangle. More... | |
| basic_Size< T_ > | GetSize () const |
| Returns the size of the rectangle. More... | |
| void | Move (const basic_Point< T_ > &p) |
| Changes the position of the rectangle. More... | |
| void | Move (const T_ &x, const T_ &y) |
| Changes the position of the rectangle. More... | |
| template<class O_ > | |
| operator basic_Bounds< O_ > () const | |
| Conversion to bounds. More... | |
| operator std::string () const | |
| Conversion to string. More... | |
| bool | operator!= (const basic_Rectangle &r) const |
| Compares two rectangles. More... | |
| template<class O_ > | |
| basic_Rectangle | operator* (const basic_Size< O_ > &amount) const |
| Scales this rectangle with the given size. More... | |
| template<class O_ > | |
| basic_Rectangle | operator* (const O_ &amount) const |
| Scales this rectangle with the given value. More... | |
| template<class O_ > | |
| basic_Rectangle & | operator*= (const basic_Size< O_ > &amount) |
| Scales this rectangle with the given size. More... | |
| template<class O_ > | |
| basic_Rectangle & | operator*= (const O_ &amount) |
| Scales this rectangle with the given value. More... | |
| basic_Rectangle | operator+ (const basic_Point< T_ > &amount) const |
| Adds a point to this rectangle, effectively translating it. More... | |
| basic_Rectangle | operator+ (const basic_Size< T_ > &amount) const |
| Adds a size to this rectangle, resizing it. More... | |
| basic_Rectangle & | operator+= (const basic_Point< T_ > &amount) |
| Adds a point to this rectangle, effectively translating it. More... | |
| basic_Rectangle & | operator+= (const basic_Size< T_ > &amount) |
| Adds a size to this rectangle, resizing it. More... | |
| basic_Rectangle | operator- (const basic_Point< T_ > &amount) const |
| Subtracts a point from this rectangle, effectively translating it. More... | |
| basic_Rectangle | operator- (const basic_Size< T_ > &amount) const |
| Subtracts a size from this rectangle, resizing it. More... | |
| basic_Rectangle & | operator-= (const basic_Point< T_ > &amount) |
| Subtracts a point to this rectangle, effectively translating it. More... | |
| basic_Rectangle & | operator-= (const basic_Size< T_ > &amount) |
| Subtracts a size from this rectangle, resizing it. More... | |
| template<class O_ > | |
| basic_Rectangle | operator/ (const basic_Size< O_ > &amount) const |
| Scales this rectangle with the given size. More... | |
| template<class O_ > | |
| basic_Rectangle | operator/ (const O_ &amount) const |
| Scales this rectangle with the given value. More... | |
| template<class O_ > | |
| basic_Rectangle & | operator/= (const basic_Size< O_ > &amount) |
| Scales this rectangle with the given size. More... | |
| template<class O_ > | |
| basic_Rectangle & | operator/= (const O_ &amount) |
| Scales this rectangle with the given value. More... | |
| bool | operator== (const basic_Rectangle &r) const |
| Compares two rectangles. More... | |
| void | Resize (const basic_Size< T_ > &s) |
| Resizes the rectangle. More... | |
| void | Resize (const T_ &w, const T_ &h) |
| Resizes the rectangle. More... | |
| T_ | Right () const |
| Calculates and returns the rightmost coordinate. More... | |
| void | SetBottom (const T_ &bottom) |
| Moves the rectangle by changing its bottommost coordinate. More... | |
| void | SetRight (const T_ &right) |
| Moves the rectangle by changing its rightmost coordinate. More... | |
| basic_Point< T_ > | TopLeft () const |
| Returns the top left coordinates of the rectangle. More... | |
| basic_Point< T_ > | TopRight () const |
| Returns the top right coordinates of the rectangle. More... | |
Static Public Member Functions | |
| static basic_Rectangle | Parse (std::string s) |
| Properly parses a rectangle, throwing errors when necessary. More... | |
Public Attributes | |
| T_ | Height |
| Height of the rectangle. More... | |
| T_ | Width |
| Width of the rectangle. More... | |
| T_ | X |
| X coordinate of the top left corner of this rectangle. More... | |
| T_ | Y |
| Y coordinate of the top left corner of this rectangle. More... | |
Represents a rectangle in a 2D space.
Top left corner and the size is stored.
| typedef T_ BaseType |
Base type of the rectangle elements.
| basic_Rectangle | ( | ) |
Default constructor, does not initialize stored values.
| basic_Rectangle | ( | const T_ & | left, |
| const T_ & | top, | ||
| const T_ & | width, | ||
| const T_ & | height | ||
| ) |
Filling constructor using values for top left corner and size.
| basic_Rectangle | ( | const basic_Point< T_ > & | position, |
| const basic_Size< T_ > & | size | ||
| ) |
Filling constructor using values for top left corner and size.
| basic_Rectangle | ( | const T_ & | left, |
| const T_ & | top, | ||
| const basic_Size< T_ > & | size | ||
| ) |
Filling constructor using values for top left corner and size.
| basic_Rectangle | ( | const basic_Point< T_ > & | position, |
| T_ | width, | ||
| T_ | height | ||
| ) |
Filling constructor using values for top left corner and size.
| basic_Rectangle | ( | const basic_Point< T_ > & | topleft, |
| const basic_Point< T_ > & | bottomright | ||
| ) |
Filling constructor using values for top left and bottom right corners.
| basic_Rectangle | ( | const basic_Rectangle< O_ > & | rect | ) |
Converting constructor from a different typed rectangle.
| basic_Rectangle | ( | const basic_Bounds< O_ > & | bounds | ) |
Converting constructor from bounds.
|
explicit |
Conversion from string.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| T_ Bottom | ( | ) | const |
Calculates and returns the bottommost coordinate.
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Y.
| basic_Point<T_> BottomLeft | ( | ) | const |
Returns the bottom left coordinates of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Point<T_> BottomRight | ( | ) | const |
Returns the bottom right coordinates of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Point<T_> Center | ( | ) | const |
Returns the center point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Size<T_> GetSize | ( | ) | const |
Returns the size of the rectangle.
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Width.
| void Move | ( | const basic_Point< T_ > & | p | ) |
Changes the position of the rectangle.
References basic_Point< T_ >::X, basic_Rectangle< T_ >::X, basic_Point< T_ >::Y, and basic_Rectangle< T_ >::Y.
| void Move | ( | const T_ & | x, |
| const T_ & | y | ||
| ) |
Changes the position of the rectangle.
References basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| operator basic_Bounds< O_ > | ( | ) | const |
Conversion to bounds.
References basic_Rectangle< T_ >::GetSize(), and basic_Rectangle< T_ >::TopLeft().
|
explicit |
Conversion to string.
References Gorgon::String::From(), basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| bool operator!= | ( | const basic_Rectangle< T_ > & | r | ) | const |
Compares two rectangles.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle operator* | ( | const basic_Size< O_ > & | amount | ) | const |
Scales this rectangle with the given size.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Size< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle operator* | ( | const O_ & | amount | ) | const |
Scales this rectangle with the given value.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle& operator*= | ( | const basic_Size< O_ > & | amount | ) |
Scales this rectangle with the given size.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, and basic_Size< T_ >::Width.
| basic_Rectangle& operator*= | ( | const O_ & | amount | ) |
Scales this rectangle with the given value.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Width.
| basic_Rectangle operator+ | ( | const basic_Point< T_ > & | amount | ) | const |
Adds a point to this rectangle, effectively translating it.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Point< T_ >::X, basic_Rectangle< T_ >::X, basic_Point< T_ >::Y, and basic_Rectangle< T_ >::Y.
| basic_Rectangle operator+ | ( | const basic_Size< T_ > & | amount | ) | const |
Adds a size to this rectangle, resizing it.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Size< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle& operator+= | ( | const basic_Point< T_ > & | amount | ) |
Adds a point to this rectangle, effectively translating it.
References basic_Point< T_ >::X, basic_Rectangle< T_ >::X, basic_Point< T_ >::Y, and basic_Rectangle< T_ >::Y.
| basic_Rectangle& operator+= | ( | const basic_Size< T_ > & | amount | ) |
Adds a size to this rectangle, resizing it.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, and basic_Size< T_ >::Width.
| basic_Rectangle operator- | ( | const basic_Point< T_ > & | amount | ) | const |
Subtracts a point from this rectangle, effectively translating it.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Point< T_ >::X, basic_Rectangle< T_ >::X, basic_Point< T_ >::Y, and basic_Rectangle< T_ >::Y.
| basic_Rectangle operator- | ( | const basic_Size< T_ > & | amount | ) | const |
Subtracts a size from this rectangle, resizing it.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Size< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle& operator-= | ( | const basic_Point< T_ > & | amount | ) |
Subtracts a point to this rectangle, effectively translating it.
References basic_Point< T_ >::X, basic_Rectangle< T_ >::X, basic_Point< T_ >::Y, and basic_Rectangle< T_ >::Y.
| basic_Rectangle& operator-= | ( | const basic_Size< T_ > & | amount | ) |
Subtracts a size from this rectangle, resizing it.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, and basic_Size< T_ >::Width.
| basic_Rectangle operator/ | ( | const basic_Size< O_ > & | amount | ) | const |
Scales this rectangle with the given size.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Size< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle operator/ | ( | const O_ & | amount | ) | const |
Scales this rectangle with the given value.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Rectangle& operator/= | ( | const basic_Size< O_ > & | amount | ) |
Scales this rectangle with the given size.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, and basic_Size< T_ >::Width.
| basic_Rectangle& operator/= | ( | const O_ & | amount | ) |
Scales this rectangle with the given value.
Origin of this operation is top left point of the rectangle.
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Width.
| bool operator== | ( | const basic_Rectangle< T_ > & | r | ) | const |
Compares two rectangles.
References basic_Rectangle< T_ >::Height, basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
|
static |
Properly parses a rectangle, throwing errors when necessary.
TODO Needs to be fixed
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Width.
| void Resize | ( | const basic_Size< T_ > & | s | ) |
Resizes the rectangle.
References basic_Rectangle< T_ >::Height, basic_Size< T_ >::Height, basic_Rectangle< T_ >::Width, and basic_Size< T_ >::Width.
| void Resize | ( | const T_ & | w, |
| const T_ & | h | ||
| ) |
Resizes the rectangle.
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Width.
| T_ Right | ( | ) | const |
Calculates and returns the rightmost coordinate.
References basic_Rectangle< T_ >::Width, and basic_Rectangle< T_ >::X.
| void SetBottom | ( | const T_ & | bottom | ) |
Moves the rectangle by changing its bottommost coordinate.
References basic_Rectangle< T_ >::Height, and basic_Rectangle< T_ >::Y.
| void SetRight | ( | const T_ & | right | ) |
Moves the rectangle by changing its rightmost coordinate.
References basic_Rectangle< T_ >::Width, and basic_Rectangle< T_ >::X.
| basic_Point<T_> TopLeft | ( | ) | const |
Returns the top left coordinates of the rectangle.
References basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| basic_Point<T_> TopRight | ( | ) | const |
Returns the top right coordinates of the rectangle.
References basic_Rectangle< T_ >::Width, basic_Rectangle< T_ >::X, and basic_Rectangle< T_ >::Y.
| T_ Height |
Height of the rectangle.
| T_ Width |
Width of the rectangle.
| T_ X |
X coordinate of the top left corner of this rectangle.
| T_ Y |
Y coordinate of the top left corner of this rectangle.