65 return (Value >= Min) && (Value <= Max);
84 this->Relative =
false;
96 this->Relative = Relative;
104 this->Position = Position;
106 this->Relative =
false;
115 this->Position = Position;
117 this->Relative = Relative;
124 this->Size = Other.
Size;
132 this->Relative =
false;
151 return this->Position.
Y;
157 return this->Position.
Y + this->Size.
Y;
163 return this->Position.
X;
169 return this->Position.
X + this->Size.
X;
176 return this->Position.
X + (this->Size.
X * 0.5);
182 return this->Position.
Y + (this->Size.
Y * 0.5);
188 return Vector2(this->GetHorizontalCenter(),this->GetVerticalCenter());
197 ValueInRange(OtherRect.
Position.
X, this->Position.X, this->Position.X + this->Size.X);
200 ValueInRange(OtherRect.
Position.
Y, this->Position.Y, this->Position.Y + this->Size.Y);
202 return (XOverlap && YOverlap);
209 return ( ValueInRange(Point.
X,this->Position.X,this->Position.X + this->Size.X) &&
210 ValueInRange(Point.
Y,this->Position.Y,this->Position.Y + this->Size.Y) );
217 return ValueInRange(Position,this->Position.X,this->Position.X + this->Size.X);
224 return ValueInRange(Position,this->Position.Y,this->Position.Y + this->Size.Y);
236 Vector2 PrevCenter = this->GetRectCenter();
237 this->Size *= Scaling;
239 this->Position.
X = PrevCenter.
X - ( this->Size.
X * 0.5 );
240 this->Position.
Y = PrevCenter.
Y - ( this->Size.
Y * 0.5 );
255 this->Size = Other.
Size;
265 return ( this->Position == Other.
Position && this->Size == Other.
Size && this->Relative == Other.
Relative );
273 return ( this->Position != Other.
Position || this->Size != Other.
Size || this->Relative != Other.
Relative );
303 if( !RectNode.
Empty() ) {
306 if( !CurrAttrib.
Empty() )
307 this->Position.
X = CurrAttrib.
AsReal();
310 if( !CurrAttrib.
Empty() )
311 this->Position.
Y = CurrAttrib.
AsReal();
314 if( !CurrAttrib.
Empty() )
315 this->Size.
X = CurrAttrib.
AsReal();
318 if( !CurrAttrib.
Empty() )
319 this->Size.
X = CurrAttrib.
AsReal();
Boole Relative
Boole representing whether this rect is represented in relative units or absolute units(pixels)...
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
void SetIdentity()
Sets all the values of this rect to zero.
A light-weight handle for manipulating attributes in DOM tree.
Boole IsWithinHeight(const Real &Position) const
Gets whether or point on the Y axis is within the limits of this rect or not.
bool Boole
Generally acts a single bit, true or false.
Real GetVerticalCenter() const
Gets the value of the vertical center of this rect.
Vector2 Size
Vector2 representing the width and height of the rect.
Real GetTopEdge() const
Gets the value of the top edge of this rect.
Thrown when the requested identity could not be found.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Boole IsWithinWidth(const Real &Position) const
Gets whether or point on the X axis is within the limits of this rect or not.
Boole ValueInRange(const Real &Value, const Real &Min, const Real &Max) const
Simple check to see if a point is within a given range.
Rect & ApplyScaling(const Vector2 &Scaling)
Scales this rect.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Rect()
No Initialization Constructor.
Boole CheckOverlap(const Rect &OtherRect) const
Checks to see if another Rect is overlapping with this one.
Real GetHorizontalCenter() const
Gets the value of the horizontal center of this rect.
This class represents a box shaped area on the screen.
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
float Real
A Datatype used to represent a real floating point number.
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
The interface for serialization.
bool SetValue(const Char8 *rhs)
Set the value of this.
Boole operator==(const Rect &Other)
Equality Comparison Operator.
Real Y
Coordinate on the Y vector.
A light-weight handle for manipulating nodes in DOM tree.
Real X
Coordinate on the X vector.
Rect(const Real &PosX, const Real &PosY, const Real &SizeX, const Real &SizeY)
Less Detailed Real Constructor.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
This is used to represent a point on a 2 dimentional area, such as a screen.
bool Empty() const
Is this storing anything at all?
Real GetRightEdge() const
Gets the value of the right edge of this rect.
void SetIdentity()
Sets the values of this vector2 to identity values(0,0).
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
Rect(const Real &PosX, const Real &PosY, const Real &SizeX, const Real &SizeY, Boole Relative)
Real Constructor.
void SetValues(const Real &x, const Real &y)
Sets the X and Y values of this vector2.
The bulk of the engine components go in this namspace.
Rect(const Rect &Other)
Copy Constructor.
Rect(const Vector2 &Position, const Vector2 &Size)
Less Detailed Vector2 Constructor.
Rect(const Vector2 &Position, const Vector2 &Size, Boole Relative)
Vector2 Constructor.
Real GetLeftEdge() const
Gets the value of the left edge of this rect.
Real GetBottomEdge() const
Gets the value of the bottom edge of this rect.
Boole IsInside(const Vector2 &Point) const
Checks to see if a point in 2D space is inside this rect.
Vector2 Position
Vector2 representing the top-left position of the rect.
void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Boole operator!=(const Rect &Other)
Inequality Comparison Operator.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
std::string String
A datatype used to a series of characters.
Rect & operator=(const Rect &Other)
Assignment Operator.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
Vector2 GetRectCenter() const
Gets the coordinates to the center of this rect.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.