#include <tb_basic_shapes.h>
Public Member Functions | |
PolygonShape (void) | |
PolygonShape (const PolygonShape &other) | |
virtual | ~PolygonShape (void) |
virtual void | SetColor (const tbGraphics::Color &newColor) override |
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::Vector2 & | GetPosition (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::Vector2 & | GetScale (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 Color & | GetColor (void) const |
float | GetWidth (void) const |
float | GetHeight (void) const |
Protected Member Functions | |
virtual void | OnRender (void) const override |
virtual void | ClearVertices (void) |
virtual void | AddVertex (const tbMath::Vector2 &position) |
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 |
Friends | |
class | OutlinedPolygonShape |
Allow creation of simple and complex shapes by supplying several points that get shaped into triangles.
TurtleBrains::Graphics::PolygonShape::PolygonShape | ( | void | ) |
Constructs an empty PolygonShape object that contains no vertices.
TurtleBrains::Graphics::PolygonShape::PolygonShape | ( | const PolygonShape & | other | ) |
Constructs a PolygonShape object with the same properties as the other object being copied.
|
virtual |
Cleans up after a PolygonShape, clearing the vertex container in the process.
|
protectedvirtual |
Adds a vertex to a container of vertices for the PolygonShape. How it will be rendered depends on how the PolygonShape object is configured.
|
protectedvirtual |
Clears all the vertices in the PolygonShape.
Reimplemented in TurtleBrains::Graphics::OutlinedPolygonShape.
|
overrideprotectedvirtual |
Computes and returns the height of the PolygonShape in pixels.
Reimplemented from TurtleBrains::Graphics::Graphic.
|
overrideprotectedvirtual |
Computes and returns the width of the PolygonShape in pixels.
Reimplemented from TurtleBrains::Graphics::Graphic.
|
overrideprotectedvirtual |
Renders the PolygonShape object vertices as Triangles, TriangleStrip, TriangleFan, Lines, LineStrip or LineLoop depending on how the object is configured to treat the vertices. Depending on the configuration this may trigger an error condition based on number of vertices.
Implements TurtleBrains::Graphics::Graphic.
Reimplemented in TurtleBrains::Graphics::OutlinedPolygonShape.
|
inlineprotected |
Configures the object to treat the vertices as a line loop, which is identical in behavior to a line strip in that at least 2 vertices must be added, (really 3 for a visible loop). Each vertex added after the first will create a line segment to the vertex added previously. A final line segment will be created automatically from the last added vertex to the very first vertex which will complete the loop.
|
inlineprotected |
Configures the object to treat the vertices as a list of lines. In this mode the number of vertices must be equal-to or greater-than 2, and must also be divisible by 2. Each pair of vertices added will form a line segment.
|
inlineprotected |
Configures the object to treat the vertices as a line strip. In this mode the number of vertices must be at least 2. Each vertex added after the first will create a line segment to the vertex added previously.
|
inlineprotected |
Configures the object to treat the vertices as a fan of Triangles. In this mode the number of vertices must be equal-to or greater-than 3. The first vertex added will be the center of the fan and used for each of the triangles.
|
inlineprotected |
Configures the object to treat the vertices as a list of Triangles. In this mode the number of vertices must be equal-to or greater-than 3, and must also be divisible by 3.
|
inlineprotected |
Configures the object to treat the vertices as a strip of Triangles. In this mode the number of vertices must be at least 3. Each vertex after the third will create a triangle using the two vertices added immediately before it.
|
overridevirtual |
Sets the color of all the vertices in the PolygonShape.
Reimplemented from TurtleBrains::Graphics::Graphic.