MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, bool Relative)
 Real Constructor. More...
 
 Rect (const Vector2 &Position, const Vector2 &Size)
 Less Detailed Vector2 Constructor. More...
 
 Rect (const Vector2 &Position, const Vector2 &Size, bool 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...
 
bool CheckOverlap (const Rect &OtherRect) const
 Checks to see if another Rect is overlapping with this one. More...
 
Vector2 GetRectCenter () const
 Gets the coordinates to the center of this rect. More...
 
bool IsInside (const Vector2 &Point) const
 Checks to see if a point in 2D space is inside this rect. More...
 
bool IsWithinHeight (const Real &Position) const
 Gets whether or point on the Y axis is within the limits of this rect or not. More...
 
bool IsWithinWidth (const Real &Position) const
 Gets whether or point on the X axis is within the limits of this rect or not. More...
 
bool operator!= (const Rect &Other)
 Inequality Comparison Operator. More...
 
Rectoperator= (const Rect &Other)
 Assignment Operator. More...
 
bool 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.
 
bool Relative
 Bool 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

bool 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 57 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 82 of file rect.h.

Mezzanine::UI::Rect::Rect ( const Real PosX,
const Real PosY,
const Real SizeX,
const Real SizeY,
bool  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.

Definition at line 93 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 103 of file rect.h.

Mezzanine::UI::Rect::Rect ( const Vector2 Position,
const Vector2 Size,
bool  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 114 of file rect.h.

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

Copy Constructor.

Parameters
OtherThe other Rect to copy.

Definition at line 122 of file rect.h.

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

No Initialization Constructor.

Sets all data members to zero's.

Definition at line 130 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 196 of file rect.h.

bool 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 156 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 149 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 288 of file rect.h.

bool 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 169 of file rect.h.

bool 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 184 of file rect.h.

bool 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 177 of file rect.h.

bool 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.

Definition at line 230 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.

Definition at line 213 of file rect.h.

bool 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.

Definition at line 223 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 257 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 240 of file rect.h.

bool 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 65 of file rect.h.


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