41 #ifndef _uisingleimagelayer_cpp
42 #define _uisingleimagelayer_cpp
44 #include "UI/singleimagelayer.h"
45 #include "UI/quadrenderable.h"
46 #include "UI/screen.h"
76 RectCorners[UI::QC_TopLeft].
X = ActDims.
Position.
X + TexelOffsetX; RectCorners[UI::QC_TopLeft].
Y = ActDims.
Position.
Y + TexelOffsetY;
77 RectCorners[UI::QC_TopRight].
X = (ActDims.
Position.
X + ActDims.
Size.
X) + TexelOffsetX; RectCorners[UI::QC_TopRight].
Y = ActDims.
Position.
Y + TexelOffsetY;
78 RectCorners[UI::QC_BottomLeft].
X = ActDims.
Position.
X + TexelOffsetX; RectCorners[UI::QC_BottomLeft].
Y = (ActDims.
Position.
Y + ActDims.
Size.
Y) + TexelOffsetY;
79 RectCorners[UI::QC_BottomRight].
X = (ActDims.
Position.
X + ActDims.
Size.
X) + TexelOffsetX; RectCorners[UI::QC_BottomRight].
Y = (ActDims.
Position.
Y + ActDims.
Size.
Y) + TexelOffsetY;
84 OuterBorder[UI::QC_TopLeft].
X = RectCorners[UI::QC_TopLeft].
X -
BorderWidth; OuterBorder[UI::QC_TopLeft].
Y = RectCorners[UI::QC_TopLeft].
Y -
BorderWidth;
85 OuterBorder[UI::QC_TopRight].
X = RectCorners[UI::QC_TopRight].
X +
BorderWidth; OuterBorder[UI::QC_TopRight].
Y = RectCorners[UI::QC_TopRight].
Y -
BorderWidth;
86 OuterBorder[UI::QC_BottomLeft].
X = RectCorners[UI::QC_BottomLeft].
X -
BorderWidth; OuterBorder[UI::QC_BottomLeft].
Y = RectCorners[UI::QC_BottomLeft].
Y +
BorderWidth;
87 OuterBorder[UI::QC_BottomRight].
X = RectCorners[UI::QC_BottomRight].
X +
BorderWidth; OuterBorder[UI::QC_BottomRight].
Y = RectCorners[UI::QC_BottomRight].
Y +
BorderWidth;
132 return ( 0 == this->
FillColours[UI::QC_TopLeft].AlphaChannel &&
133 0 == this->
FillColours[UI::QC_TopRight].AlphaChannel &&
134 0 == this->
FillColours[UI::QC_BottomLeft].AlphaChannel &&
135 0 == this->
FillColours[UI::QC_BottomRight].AlphaChannel );
163 case UI::Gradient_NorthSouth:
171 case UI::Gradient_WestEast:
179 case UI::Gradient_Diagonal_1:
192 case UI::Gradient_Diagonal_2:
246 if( !PropertiesNode.
Empty() ) {
248 String SpriteName, SpriteAtlas;
251 if( !CurrAttrib.
Empty() )
254 CurrAttrib = PropertiesNode.
GetAttribute(
"SpriteAtlas");
255 if( !CurrAttrib.
Empty() )
256 SpriteAtlas = CurrAttrib.
AsString();
262 if( !TopLeftFillNode.
Empty() )
266 if( !TopRightFillNode.
Empty() )
270 if( !BottomLeftFillNode.
Empty() )
274 if( !BottomRightFillNode.
Empty() )
288 {
return "SingleImageLayer"; }
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.
const String Name
The name of this sprite.
bool Boole
Generally acts a single bit, true or false.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this Renderable.
virtual void RotationTransform(Vector2 &Point, const Vector2 &RotationCenter)
Applies rotation to a point in 2D space.
virtual void RedrawImpl(Boole Force)
Provides the class specific implementation for regenerating vertices for this renderable.
virtual Rect GetAreaRect() const
Gets a rect containing the actual position and size of this layer.
Vector2 Size
Vector2 representing the width and height of the rect.
Thrown when the requested identity could not be found.
QuadCorner
Used by Sprites and Glyphs for tracking their placement on a TextureAtlas.
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.
String PriAtlas
This contains the name of the atlas that will be used as default when one isn't specified.
virtual ~SingleImageLayer()
Class destructor.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
static ColourValue White()
Creates a ColourValue representing the colour White.
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
Screen * GetScreen() const
Gets the parent screen of this renderable.
This class represents a box shaped area on the screen.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
virtual void _MarkDirty()
Marks this renderable as well as all parent objects as dirty.
bool Empty() const
Is this storing anything at all?
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
float Real
A Datatype used to represent a real floating point number.
bool SetValue(const Char8 *rhs)
Set the value of this.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Real GreenChannel
Value from 0.0 to 1.0 representing the amount of green present in the colour. 1.0 if very green...
Value representing a SingleImageLayer.
Real Y
Coordinate on the Y vector.
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.
Real X
Coordinate on the X vector.
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?
Gradient
Used by various basic renderables for applying a gradient effect to a colour or texture on a quad...
Real AlphaChannel
Value from 0.0 to 1.0 representing the transparency of the colours. 1.0 is opaque and 0...
Sprite * GetSprite(const String &SpriteName, const String &Atlas) const
Gets a sprite from an Atlas.
void DrawBorder(const Vector2 *InnerRect, const Vector2 *OuterRect)
Draws the border, if any is set.
This layer is for placing images and basic colours in it's parents' quad space.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
Real GetTexelOffsetX() const
Gets the X axis Texel Offset for the current rendersystem.
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 const ColourValue & GetColour(const UI::QuadCorner Corner) const
Gets the colour of a corner of this layer.
Sprite * LayerSprite
A pointer to the sprite that will be rendered by this layer.
virtual void SetColour(const ColourValue &Colour)
Sets the colour of the layer.
virtual void SetSprite(Sprite *NewSprite)
Sets the fill image(if provided in the atlas) of the layer.
virtual Boole IsCompletelyTransparent() const
Gets whether or not this layer is entirely transparent.
virtual String GetPrimaryAtlas()
Gets the currently set primary atlas.
virtual UI::RenderLayerType GetLayerType() const
Gets the type of render layer this is.
RenderLayerType
This enum describes the type of RenderLayer this is for use in casting.
The bulk of the engine components go in this namspace.
Real BorderWidth
The width of the border to render around this layer in pixels.
Real BlueChannel
Value from 0.0 to 1.0 representing the amount of blue present in the colour. 1.0 if very blue...
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
SingleImageLayer(QuadRenderable *ParentRenderable)
Class constructor.
Real RedChannel
Value from 0.0 to 1.0 representing the amount of red present in the colour. 1.0 if very red...
virtual void SetGradient(const UI::Gradient Grad, const ColourValue &ColourA, const ColourValue &ColourB)
Sets a colour gradient to be applied to this layer.
ColourValue FillColours[4]
An array of colours to be used for each corner section of this layer.
This represents a nestable quad for an object in a GUI layout.
Vector2 Position
Vector2 representing the top-left position of the rect.
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.
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.
Real GetTexelOffsetY() const
Gets the Y axis Texel Offset for the current rendersystem.
const String & GetAtlasName() const
Gets the name of the atlas this sprite belongs to.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.