40 #ifndef _uiimagelayer_cpp
41 #define _uiimagelayer_cpp
43 #include "UI/imagelayer.h"
44 #include "UI/quadrenderable.h"
45 #include "UI/screen.h"
69 if( 0 != this->
BorderColours[UI::Border_North].AlphaChannel ) {
70 this->
PushTriangle( InnerRect[UI::QC_TopLeft], OuterRect[UI::QC_TopRight], OuterRect[UI::QC_TopLeft], WP, this->
BorderColours[UI::Border_North], this->
PriAtlas );
71 this->
PushTriangle( InnerRect[UI::QC_TopLeft], InnerRect[UI::QC_TopRight], OuterRect[UI::QC_TopRight], WP, this->
BorderColours[UI::Border_North], this->
PriAtlas );
74 if( 0 != this->
BorderColours[UI::Border_East].AlphaChannel ) {
75 this->
PushTriangle( InnerRect[UI::QC_BottomRight], OuterRect[UI::QC_TopRight], InnerRect[UI::QC_TopRight], WP, this->
BorderColours[UI::Border_East], this->
PriAtlas );
76 this->
PushTriangle( InnerRect[UI::QC_BottomRight], OuterRect[UI::QC_BottomRight], OuterRect[UI::QC_TopRight], WP, this->
BorderColours[UI::Border_East], this->
PriAtlas );
79 if( 0 != this->
BorderColours[UI::Border_South].AlphaChannel ) {
80 this->
PushTriangle( OuterRect[UI::QC_BottomLeft], InnerRect[UI::QC_BottomRight], InnerRect[UI::QC_BottomLeft], WP, this->
BorderColours[UI::Border_South], this->
PriAtlas );
81 this->
PushTriangle( OuterRect[UI::QC_BottomLeft], OuterRect[UI::QC_BottomRight], InnerRect[UI::QC_BottomRight], WP, this->
BorderColours[UI::Border_South], this->
PriAtlas );
84 if( 0 != this->
BorderColours[UI::Border_West].AlphaChannel ) {
93 if( FillSprite == NULL ) {
103 this->
PushVertex( FillRect[UI::QC_BottomLeft].X, FillRect[UI::QC_BottomLeft].Y, UVs[UI::QC_BottomLeft], FillColours[UI::QC_BottomLeft], this->
PriAtlas );
104 this->
PushVertex( FillRect[UI::QC_TopRight].X, FillRect[UI::QC_TopRight].Y, UVs[UI::QC_TopRight], FillColours[UI::QC_TopRight], this->
PriAtlas );
105 this->
PushVertex( FillRect[UI::QC_TopLeft].X, FillRect[UI::QC_TopLeft].Y, UVs[UI::QC_TopLeft], FillColours[UI::QC_TopLeft], this->
PriAtlas );
108 this->
PushVertex( FillRect[UI::QC_BottomLeft].X, FillRect[UI::QC_BottomLeft].Y, UVs[UI::QC_BottomLeft], FillColours[UI::QC_BottomLeft], this->
PriAtlas );
109 this->
PushVertex( FillRect[UI::QC_BottomRight].X, FillRect[UI::QC_BottomRight].Y, UVs[UI::QC_BottomRight], FillColours[UI::QC_BottomRight], this->
PriAtlas );
110 this->
PushVertex( FillRect[UI::QC_TopRight].X, FillRect[UI::QC_TopRight].Y, UVs[UI::QC_TopRight], FillColours[UI::QC_TopRight], this->
PriAtlas );
205 if( !PropertiesNode.
Empty() ) {
207 CurrAttrib = PropertiesNode.
GetAttribute(
"BorderWidth");
208 if( !CurrAttrib.
Empty() )
213 if( !TopLeftBorderNode.
Empty() )
217 if( !TopRightBorderNode.
Empty() )
221 if( !BottomLeftBorderNode.
Empty() )
225 if( !BottomRightBorderNode.
Empty() )
239 {
return "ImageLayer"; }
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
A light-weight handle for manipulating attributes in DOM tree.
virtual void SetBorderColour(const ColourValue &Colour)
Sets the colour of the border for this renderable.
virtual void PushTriangle(const Vector2 &A, const Vector2 &B, const Vector2 &C, const Vector2 &UV, const ColourValue &Colour, const String &Atlas)
Pushes vertex information for a triangle to a vector. Equivalent to calling "PushVertex" three times...
Thrown when the requested identity could not be found.
Node GetFirstChild() const
Get the first child Node of this Node.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
QuadRenderable * Parent
A pointer to the parent of this RenderLayer.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
String PriAtlas
This contains the name of the atlas that will be used as default when one isn't specified.
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Screen * GetScreen() const
Gets the parent screen of this renderable.
static ColourValue Black()
Creates a ColourValue representing the colour Black.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this Renderable.
virtual void _MarkDirty()
Marks this renderable as well as all parent objects as dirty.
bool Empty() const
Is this storing anything at all?
virtual void NoBorder()
Disables any border set on this renderable if one is currently set.
float Real
A Datatype used to represent a real floating point number.
bool SetValue(const Char8 *rhs)
Set the value of this.
Vector2 GetWhitePixel(const String &Atlas) const
Gets the position of the white pixel from an Atlas.
void DrawFill(const Vector2 *FillRect, const Sprite *FillSprite, const ColourValue *FillColours)
Draws the main rectangle.
A light-weight handle for manipulating nodes in DOM tree.
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?
void DrawBorder(const Vector2 *InnerRect, const Vector2 *OuterRect)
Draws the border, if any is set.
virtual ~ImageLayer()
Class destructor.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
virtual void SetBorder(const Real Width, const ColourValue &Colour)
Sets all parameters for enabling a border.
virtual Real GetBorderWidth() const
Gets the border width of this renderable.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
Vector2 GetRelativeAtlasCoords(const UI::QuadCorner Corner) const
Gets the relative position on the Atlas of a corner belonging to this Sprite.
The bulk of the engine components go in this namspace.
Real BorderWidth
The width of the border to render around this layer in pixels.
virtual const ColourValue & GetBorderColour(const UI::Border Side) const
Gets the colour of a border on this renderable.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
ColourValue BorderColours[4]
An array of colours to be used for each corner section of the border being rendered with this layer...
virtual void SetBorderWidth(const Real Width)
Sets the width of the border for this renderable.
This represents a nestable quad for an object in a GUI layout.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
Border
Used by various basic renderables for border effects.
Basic class used to describe a portion of a texture to be applied to a Quad.
std::string String
A datatype used to a series of characters.
ImageLayer(QuadRenderable *ParentRenderable)
Class constructor.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual void PushVertex(const Real &X, const Real &Y, const Vector2 &UV, const ColourValue &Colour, const String &Atlas)
Collects all the relevant information for a single vertex and pushes it to a vector.
This is the base class for the types of layers that can be added to a renderable. ...
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.