TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
TurtleBrains::Graphics::OutlinedPolygonShape Class Reference

#include <tb_basic_shapes.h>

Inheritance diagram for TurtleBrains::Graphics::OutlinedPolygonShape:
TurtleBrains::Graphics::PolygonShape TurtleBrains::Graphics::Graphic TurtleBrains::Graphics::OutlinedBoxShape TurtleBrains::Graphics::OutlinedCircleShape

Public Member Functions

 OutlinedPolygonShape (void)
 
 OutlinedPolygonShape (const OutlinedPolygonShape &other)
 
virtual ~OutlinedPolygonShape (void)
 
virtual void ClearVertices (void) override
 
void SetFillColor (const tbGraphics::Color &fillColor)
 
void SetOutlineColor (const tbGraphics::Color &outlineColor)
 
- Public Member Functions inherited from TurtleBrains::Graphics::PolygonShape
 PolygonShape (void)
 
 PolygonShape (const PolygonShape &other)
 
virtual ~PolygonShape (void)
 
- Public Member Functions inherited from TurtleBrains::Graphics::Graphic
 Graphic (void)
 
 Graphic (const Graphic &other)
 
virtual ~Graphic (void)
 
bool IsActive (void) const
 
void SetActive (const bool isActive)
 
void Update (const float deltaTime)
 
bool IsVisible (void) const
 
void SetVisible (const bool isVisible)
 
void Render (void) const
 
const tbMath::Vector2GetPosition (void) const
 
void SetPosition (const float x, const float y)
 
void SetPosition (const tbMath::Vector2 &position)
 
void SetOrigin (const AnchorLocation &anchor, const tbMath::Vector2 &offset=tbMath::Vector2::Zero())
 
void SetOrigin (const float originX, const float originY)
 
void SetOrigin (const tbMath::Vector2 &origin)
 
float GetDepth (void) const
 
void SetDepth (const float newDepth)
 
const tbMath::Vector2GetScale (void) const
 
void SetScale (const float scale)
 
void SetScale (const float scaleX, const float scaleY)
 
float GetRotation (void) const
 
void SetRotation (const float rotation)
 
void SetScroll (const float scroll)
 
void SetScroll (const float scrollX, const float scrollY)
 
bool IsRelative (void) const
 
const ColorGetColor (void) const
 
float GetWidth (void) const
 
float GetHeight (void) const
 

Protected Member Functions

void AddOutlineVertex (const tbMath::Vector2 &position)
 
void AddShapeVertex (const tbMath::Vector2 &position)
 
void AddShapeAndOutlineVertex (const tbMath::Vector2 &position)
 
virtual void OnRender (void) const override
 
- Protected Member Functions inherited from TurtleBrains::Graphics::PolygonShape
virtual PixelSpace GetPixelWidth (void) const override
 
virtual PixelSpace GetPixelHeight (void) const override
 
void SetAsTriangles (void)
 
void SetAsTriangleFan (void)
 
void SetAsTriangleStrip (void)
 
void SetAsLines (void)
 
void SetAsLineStrip (void)
 
void SetAsLineLoop (void)
 
- Protected Member Functions inherited from TurtleBrains::Graphics::Graphic
virtual void OnUpdate (const float deltaTime)
 
virtual void ApplyTransform (void) const
 
virtual void PopTransform (void) const
 

Detailed Description

The OutlinedPolygonShape class extends the Polygon shape to include an outline around it along with the filled shape.

Constructor & Destructor Documentation

TurtleBrains::Graphics::OutlinedPolygonShape::OutlinedPolygonShape ( void  )

Constructs an empty shape with no vertices.

TurtleBrains::Graphics::OutlinedPolygonShape::OutlinedPolygonShape ( const OutlinedPolygonShape other)

Constructs a polygon shape by copying the vertices and information from an existing shape.

virtual TurtleBrains::Graphics::OutlinedPolygonShape::~OutlinedPolygonShape ( void  )
virtual

Cleans up all vertex data.

Member Function Documentation

void TurtleBrains::Graphics::OutlinedPolygonShape::AddOutlineVertex ( const tbMath::Vector2 position)
protected

Adds a vertex only to the outline line loop and not the filled shape. The outline is always a line list that loops back to the first vertex.

Parameters
positionThe position of the vertex to add to the outlined line loop.
void TurtleBrains::Graphics::OutlinedPolygonShape::AddShapeAndOutlineVertex ( const tbMath::Vector2 position)
protected

Adds a vertex to both the outlined line loop and the filled shape. See AddOutlineVertex and AddShapeVertex() for more information.

Parameters
positionThe position of the vertex to add to both the outlined line loop and the filled shape.
void TurtleBrains::Graphics::OutlinedPolygonShape::AddShapeVertex ( const tbMath::Vector2 position)
protected

Adds a vertex only to the filled shape triangles and not the outline list.

Parameters
positionThe position of the vertex to add to the filled shape, behavior may depend on the mode of the polygon shape, Triangles, TriangleStrip or TriangleFan.
virtual void TurtleBrains::Graphics::OutlinedPolygonShape::ClearVertices ( void  )
overridevirtual

Clears all vertices from both the filled shape and the outline.

Reimplemented from TurtleBrains::Graphics::PolygonShape.

virtual void TurtleBrains::Graphics::OutlinedPolygonShape::OnRender ( void  ) const
overrideprotectedvirtual

Renders the filled polygon shape first, exactly as described in PolygonShape::OnRender() then renders the outline line loop.

Reimplemented from TurtleBrains::Graphics::PolygonShape.

void TurtleBrains::Graphics::OutlinedPolygonShape::SetFillColor ( const tbGraphics::Color fillColor)

This will change the color of the filled portion of the OutlinedPolygonShape, behaves exactly like PolygonShape::SetColor().

Parameters
fillColorThe desired fill color.
void TurtleBrains::Graphics::OutlinedPolygonShape::SetOutlineColor ( const tbGraphics::Color outlineColor)

Change the color of the outline surrounding the shape.

Parameters
outlineColorThe desired color of the outline.