40 #ifndef _uilinelist_cpp
41 #define _uilinelist_cpp
43 #include "UI/linelist.h"
44 #include "UI/uienumerations.h"
45 #include "UI/uimanager.h"
46 #include "UI/screen.h"
47 #include "UI/simplerenderer.h"
79 if(Positions.size() < 2)
83 Real HalfThickness = Thickness * 0.5;
86 while( Index < Positions.size() )
88 PerpNorm = (Positions[Index] - Positions[Index - 1]).Perpendicular().
Normalize();
89 LastLeft = Positions[Index -1 ] - PerpNorm * HalfThickness;
90 LastRight = Positions[Index -1 ] + PerpNorm * HalfThickness;
91 ThisLeft = Positions[Index] - PerpNorm * HalfThickness;
92 ThisRight = Positions[Index] + PerpNorm * HalfThickness;
95 this->PushVertex(LastRight.
X,LastRight.
Y,UV,Colour,PriAtlas);
96 this->PushVertex(ThisLeft.
X,ThisLeft.
Y,UV,Colour,PriAtlas);
97 this->PushVertex(LastLeft.
X,LastLeft.
Y,UV,Colour,PriAtlas);
99 this->PushVertex(LastRight.
X,LastRight.
Y,UV,Colour,PriAtlas);
100 this->PushVertex(ThisRight.
X,ThisRight.
Y,UV,Colour,PriAtlas);
101 this->PushVertex(ThisLeft.
X,ThisLeft.
Y,UV,Colour,PriAtlas);
107 Index = Positions.size() - 1;
108 PerpNorm = (Positions[0] - Positions[Index]).Perpendicular().
Normalize();
109 LastLeft = Positions[Index] - PerpNorm * HalfThickness;
110 LastRight = Positions[Index] + PerpNorm * HalfThickness;
111 ThisLeft = Positions[0] - PerpNorm * HalfThickness;
112 ThisRight = Positions[0] + PerpNorm * HalfThickness;
115 this->PushVertex(LastRight.
X,LastRight.
Y,UV,Colour,PriAtlas);
116 this->PushVertex(ThisLeft.
X,ThisLeft.
Y,UV,Colour,PriAtlas);
117 this->PushVertex(LastLeft.
X,LastLeft.
Y,UV,Colour,PriAtlas);
119 this->PushVertex(LastRight.
X,LastRight.
Y,UV,Colour,PriAtlas);
120 this->PushVertex(ThisRight.
X,ThisRight.
Y,UV,Colour,PriAtlas);
121 this->PushVertex(ThisLeft.
X,ThisLeft.
Y,UV,Colour,PriAtlas);
166 this->
Colour = LineColour;
206 return Renderable::RT_LineList;
ColourValue Colour
The colour of the line.
A simple class providing basic methods to generate vertices with.
virtual Boole GetVisible() const
Gets the visibility setting of this renderable.
Basic class for all structures that get inserted into the rendering hierarchy.
virtual void SetVisible(Boole CanSee)
Sets the visibility of this renderable.
LineList & Begin(const Whole &LineThickness, const ColourValue &LineColour)
Starts a new line list.
Boole _IsDirty()
Gets whether or not this renderer is dirty.
std::vector< VertexData > Vertices
Container storing all of the vertices to be rendered.
bool Boole
Generally acts a single bit, true or false.
virtual void Hide()
Forces this renderable to hide.
virtual Boole IsVisible() const
Gets whether or not this renderable is being drawn.
void _AppendVertices(std::vector< VertexData > &Vertices)
Appends the vertices of this renderable to another vector.
virtual void _MarkDirty()
Marks this renderable as dirty, and informs other renderables if needed.
LineList & AddPoint(const Real &X, const Real &Y)
Adds a new point/line to the list via 2 reals.
const ColourValue & GetLineColour() const
Gets the colour of this linelist.
Boole IsClosed() const
Gets whether or not this linelist is enclosed.
virtual void Show()
Forces this renderable to be shown.
Boole Visible
Stores whether this Renderable is to be rendered (also dependent on parent visibility).
virtual Boole IsVisible() const
Gets whether or not this renderable is being drawn.
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 void UpdateDimensions()
Updates the dimensions of this QuadRenderable based on the transform of it's parent.
virtual ~LineList()
Class destructor.
This is a renderer class specifically designed to draw lines.
LineList(const String &RendName, Screen *PScreen)
Class constructor.
float Real
A Datatype used to represent a real floating point number.
LineList * Parent
a pointer to the LineList this rendered is rendering for.
void End(Boole Closed=false)
Finalizes the list and prepares it for rendering.
Vector2 GetWhitePixel(const String &Atlas) const
Gets the position of the white pixel from an Atlas.
Real Y
Coordinate on the Y vector.
RenderableType GetRenderableType() const
Gets the type of renderable this is.
Real Thickness
The pixel thickness of the each line segment in this linelist.
const Real & GetLineThickness() const
Gets the thickness of the line generated by this linelist.
Real X
Coordinate on the X vector.
This is used to represent a point on a 2 dimentional area, such as a screen.
virtual ~LineListRenderer()
Class destructor.
std::vector< Vector2 > PointVector
Basic container type for the storage of all the points in 2D space that create the line to be rendere...
const PointVector & GetPoints() const
Gets the vector of points stored by this linelist.
PointVector Positions
The points in 2D space that create this line.
Basic class describing a vertex in the UI to be rendered.
virtual void _AppendRenderData(ScreenRenderData &RenderData)
Appends the vertices of this renderable to another vector.
LineList & AddActualPoint(const Real &X, const Real &Y)
Adds a new point/line to the list via 2 reals.
virtual void _MarkDirty()
Marks this renderable as well as all parent objects as dirty.
LineListRenderer * Renderer
The internal renderer responsible for generating this lines vertices.
The bulk of the engine components go in this namspace.
This class stores all vertices pertaining to a layer sorted by their priority for rendering...
Boole Closed
A bool indicating whether or not an additional segment should be generated between the first and last...
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Vector2 & Normalize()
Normalizes this Vector2.
Boole Dirty
Stores whether this Renderables vertices need to be regenerated.
void _Redraw(Boole Force)
Regenerates the verticies in this renderable.
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
std::string String
A datatype used to a series of characters.
RenderableType
A small enum to describe the type of renderable this is.
virtual void RedrawImpl(Boole Force)
Provides the class specific implementation for regenerating vertices for this renderable.
LineListRenderer(LineList *LL)
Class constructor.
This is an object comprised of a series of lines.
Screen * ParentScreen
A pointer to the Screen that created this Renderable.