Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Mezzanine::UI::Rect Class Reference

This class represents a box shaped area on the screen. More...

#include <rect.h>

+ Collaboration diagram for Mezzanine::UI::Rect:

Public Member Functions

 Rect (const Real &PosX, const Real &PosY, const Real &SizeX, const Real &SizeY)
 Less Detailed Real Constructor. More...
 
 Rect (const Real &PosX, const Real &PosY, const Real &SizeX, const Real &SizeY, Boole Relative)
 Real Constructor. More...
 
 Rect (const Vector2 &Position, const Vector2 &Size)
 Less Detailed Vector2 Constructor. More...
 
 Rect (const Vector2 &Position, const Vector2 &Size, Boole Relative)
 Vector2 Constructor. More...
 
 Rect (const Rect &Other)
 Copy Constructor. More...
 
 Rect ()
 No Initialization Constructor. More...
 
 ~Rect ()
 Class destructor.
 
RectApplyScaling (const Vector2 &Scaling)
 Scales this rect. More...
 
Boole CheckOverlap (const Rect &OtherRect) const
 Checks to see if another Rect is overlapping with this one. More...
 
Real GetBottomEdge () const
 Gets the value of the bottom edge of this rect. More...
 
Real GetHorizontalCenter () const
 Gets the value of the horizontal center of this rect. More...
 
Real GetLeftEdge () const
 Gets the value of the left edge of this rect. More...
 
Vector2 GetRectCenter () const
 Gets the coordinates to the center of this rect. More...
 
Real GetRightEdge () const
 Gets the value of the right edge of this rect. More...
 
Real GetTopEdge () const
 Gets the value of the top edge of this rect. More...
 
Real GetVerticalCenter () const
 Gets the value of the vertical center of this rect. More...
 
Boole IsInside (const Vector2 &Point) const
 Checks to see if a point in 2D space is inside this rect. More...
 
Boole IsWithinHeight (const Real &Position) const
 Gets whether or point on the Y axis is within the limits of this rect or not. More...
 
Boole IsWithinWidth (const Real &Position) const
 Gets whether or point on the X axis is within the limits of this rect or not. More...
 
Boole operator!= (const Rect &Other)
 Inequality Comparison Operator. More...
 
Rectoperator= (const Rect &Other)
 Assignment Operator. More...
 
Boole operator== (const Rect &Other)
 Equality Comparison Operator. More...
 
void ProtoDeSerialize (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite this object with it. More...
 
void ProtoSerialize (XML::Node &ParentNode) const
 Convert this class to an XML::Node ready for serialization. More...
 
void SetIdentity ()
 Sets all the values of this rect to zero.
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized. More...
 

Public Attributes

Vector2 Position
 Vector2 representing the top-left position of the rect.
 
Boole Relative
 Boole representing whether this rect is represented in relative units or absolute units(pixels).
 
Vector2 Size
 Vector2 representing the width and height of the rect.
 

Protected Member Functions

Boole ValueInRange (const Real &Value, const Real &Min, const Real &Max) const
 Simple check to see if a point is within a given range. More...
 

Detailed Description

This class represents a box shaped area on the screen.

Definition at line 55 of file rect.h.

Constructor & Destructor Documentation

Mezzanine::UI::Rect::Rect ( const Real PosX,
const Real PosY,
const Real SizeX,
const Real SizeY 
)
inline

Less Detailed Real Constructor.

Parameters
PosXThe position of this rect on the X axis.
PosYThe position of this rect on the Y axis.
SizeXThe size of this rect on the X axis.
SizeYThe size of this rect on the Y axis.

Definition at line 80 of file rect.h.

Mezzanine::UI::Rect::Rect ( const Real PosX,
const Real PosY,
const Real SizeX,
const Real SizeY,
Boole  Relative 
)
inline

Real Constructor.

Parameters
PosXThe position of this rect on the X axis.
PosYThe position of this rect on the Y axis.
SizeXThe size of this rect on the X axis.
SizeYThe size of this rect on the Y axis.
RelativeWhether or not this Rect is expressing relative coordinates (0-1).

Definition at line 92 of file rect.h.

Mezzanine::UI::Rect::Rect ( const Vector2 Position,
const Vector2 Size 
)
inline

Less Detailed Vector2 Constructor.

Sets all the data of the class.

Parameters
PositionThe position of the Renderable's Rect.
SizeThe size of the Renderable's Rect.

Definition at line 102 of file rect.h.

Mezzanine::UI::Rect::Rect ( const Vector2 Position,
const Vector2 Size,
Boole  Relative 
)
inline

Vector2 Constructor.

Sets all the data of the class.

Parameters
PositionThe position of the Renderable's Rect.
SizeThe size of the Renderable's Rect.
RelativeWhether or not this Rect is using relative(0-1) or absolute units(Pixels).

Definition at line 113 of file rect.h.

Mezzanine::UI::Rect::Rect ( const Rect Other)
inline

Copy Constructor.

Parameters
OtherThe other Rect to copy.

Definition at line 121 of file rect.h.

Mezzanine::UI::Rect::Rect ( )
inline

No Initialization Constructor.

Sets all data members to zero's.

Definition at line 129 of file rect.h.

Member Function Documentation

Rect& Mezzanine::UI::Rect::ApplyScaling ( const Vector2 Scaling)
inline

Scales this rect.

Note
This will scale the rect based on it's center, not it's top-left position. If you want to instead preserve the position of the Rect then apply the scaling manually.
Parameters
ScalingA Vector2 representing the X and Y scaling to be applied to this rect.
Returns
Returns a reference to this.

Definition at line 234 of file rect.h.

Boole Mezzanine::UI::Rect::CheckOverlap ( const Rect OtherRect) const
inline

Checks to see if another Rect is overlapping with this one.

Parameters
OtherRectThe other rect to compare against.
Returns
Returns true if these rects overlap with each other, false otherwise.

Definition at line 194 of file rect.h.

Real Mezzanine::UI::Rect::GetBottomEdge ( ) const
inline

Gets the value of the bottom edge of this rect.

Returns
Returns a Real that is the point on the vertical axis this rect's bottom edge is located.

Definition at line 155 of file rect.h.

Real Mezzanine::UI::Rect::GetHorizontalCenter ( ) const
inline

Gets the value of the horizontal center of this rect.

Returns
Returns a Real that is the point on the horizontal axis that is this rect's center.

Definition at line 174 of file rect.h.

Real Mezzanine::UI::Rect::GetLeftEdge ( ) const
inline

Gets the value of the left edge of this rect.

Returns
Returns a Real that is the point on the horizontal axis this rect's left edge is located.

Definition at line 161 of file rect.h.

Vector2 Mezzanine::UI::Rect::GetRectCenter ( ) const
inline

Gets the coordinates to the center of this rect.

Returns
Returns a vector2 containing the central point of this rect.

Definition at line 186 of file rect.h.

Real Mezzanine::UI::Rect::GetRightEdge ( ) const
inline

Gets the value of the right edge of this rect.

Returns
Returns a Real that is the point on the horizontal axis this rect's right edge is located.

Definition at line 167 of file rect.h.

static String Mezzanine::UI::Rect::GetSerializableName ( )
inlinestatic

Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized.

Returns
A string containing the name of this class.

Definition at line 329 of file rect.h.

Real Mezzanine::UI::Rect::GetTopEdge ( ) const
inline

Gets the value of the top edge of this rect.

Returns
Returns a Real that is the point on the vertical axis this rect's top edge is located.

Definition at line 149 of file rect.h.

Real Mezzanine::UI::Rect::GetVerticalCenter ( ) const
inline

Gets the value of the vertical center of this rect.

Returns
Returns a Real that is the point on the vertical axis that is this rect's center.

Definition at line 180 of file rect.h.

Boole Mezzanine::UI::Rect::IsInside ( const Vector2 Point) const
inline

Checks to see if a point in 2D space is inside this rect.

Parameters
PointThe point in 2D space to check.
Returns
Returns true if the provided point is within this rect, false otherwise.

Definition at line 207 of file rect.h.

Boole Mezzanine::UI::Rect::IsWithinHeight ( const Real Position) const
inline

Gets whether or point on the Y axis is within the limits of this rect or not.

Parameters
PositionThe point on the Y axis.
Returns
Returns true in the provided position is within this rect's limits, false otherwise.

Definition at line 222 of file rect.h.

Boole Mezzanine::UI::Rect::IsWithinWidth ( const Real Position) const
inline

Gets whether or point on the X axis is within the limits of this rect or not.

Parameters
PositionThe point on the X axis.
Returns
Returns true in the provided position is within this rect's limits, false otherwise.

Definition at line 215 of file rect.h.

Boole Mezzanine::UI::Rect::operator!= ( const Rect Other)
inline

Inequality Comparison Operator.

Checks to see if the two rects are different.

Parameters
OtherThe other Rect to compare against.
Returns
Returns false of this Rect is equal to the other, true otherwise.

Definition at line 271 of file rect.h.

Rect& Mezzanine::UI::Rect::operator= ( const Rect Other)
inline

Assignment Operator.

Copys the contents of a Rect to another.

Parameters
OtherThe other Rect to copy from.
Returns
Returns a reference to this.

Definition at line 252 of file rect.h.

Boole Mezzanine::UI::Rect::operator== ( const Rect Other)
inline

Equality Comparison Operator.

Checks to see if the two Rects are equal.

Parameters
OtherThe other Rect to compare against.
Returns
Returns true if this Rect is equal to the Other, false otherwise.

Definition at line 263 of file rect.h.

void Mezzanine::UI::Rect::ProtoDeSerialize ( const XML::Node SelfRoot)
inline

Take the data stored in an XML Node and overwrite this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 298 of file rect.h.

void Mezzanine::UI::Rect::ProtoSerialize ( XML::Node ParentNode) const
inline

Convert this class to an XML::Node ready for serialization.

Parameters
ParentNodeThe point in the XML hierarchy that all this renderable should be appended to.

Definition at line 281 of file rect.h.

Boole Mezzanine::UI::Rect::ValueInRange ( const Real Value,
const Real Min,
const Real Max 
) const
inlineprotected

Simple check to see if a point is within a given range.

Parameters
ValueThe value to compare against the range.
MinThe minimum value of the range.
MaxThe maximum value of the range.
Returns
Returns true if the provided value is within the provided range, false otherwise.

Definition at line 63 of file rect.h.


The documentation for this class was generated from the following file: