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

#include <tb_basic_shapes.hpp>

Inheritance diagram for TurtleBrains::Graphics::BoxShape:
TurtleBrains::Graphics::PolygonShape TurtleBrains::Graphics::Graphic TurtleBrains::Graphics::FullScreenQuad

Public Member Functions

 BoxShape (const float width=64.0f, const float height=64.0f, const tbGraphics::Color &color=tbGraphics::ColorPalette::White, const tbMath::Vector2 &position=tbMath::Vector2::Zero())
 
void SetSize (const float width, const float height)
 
virtual ~BoxShape (void)
 
- Public Member Functions inherited from TurtleBrains::Graphics::PolygonShape
 PolygonShape (void)
 
 PolygonShape (const PolygonShape &other)
 
virtual ~PolygonShape (void)
 
virtual void SetColor (const tbGraphics::Color &newColor) override
 
virtual PixelSpace GetPixelWidth (void) const override
 
virtual PixelSpace GetPixelHeight (void) const 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::Vector2GetPosition (void) const
 
void SetPosition (const float x, const float y)
 
void SetPosition (const tbMath::Vector2 &position)
 
const tbMath::Vector2GetOrigin (void) const
 
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 tbMath::Vector2 &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
 
float GetScaledWidth (void) const
 
float GetScaledHeight (void) const
 
bool UnstableIsPointContained (const tbMath::Vector2 &point) const
 

Additional Inherited Members

- Protected Member Functions inherited from TurtleBrains::Graphics::PolygonShape
virtual void OnRender (void) const override
 
virtual void ClearVertices (void)
 
virtual void AddVertex (const tbMath::Vector2 &position)
 
void SetAsTriangles (void)
 
void SetAsTriangleFan (void)
 
void SetAsTriangleStrip (void)
 
void SetAsLines (void)
 
void SetAsLineStrip (void)
 
void SetAsLineLoop (void)
 
void SetVertexPosition (size_t vertexIndex, const tbMath::Vector2 &position)
 
void RecomputeBounds (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 BoxShape is a special case of the PolygonShape that creates a box with a specified width and height of a specific color.

Constructor & Destructor Documentation

TurtleBrains::Graphics::BoxShape::BoxShape ( const float  width = 64.0f,
const float  height = 64.0f,
const tbGraphics::Color color = tbGraphics::ColorPalette::White,
const tbMath::Vector2 position = tbMath::Vector2::Zero() 
)
explicit

Constructs a PolygonShape in the form of a box with the given parameters, position, width, height.

Parameters
widthThe width of the box, the units are in pixels unless projection/view matrix changed.
heightThe vertical size of the box, in pixel units unless projection/view matrix changed.
colorWhat color the box should be when rendered, can be changed later with SetColor().
positionThe position of the top-left corner of the box... TODO: TurtleBrains: Documentation: Check this fact, it may be different depending on anchor point.
virtual TurtleBrains::Graphics::BoxShape::~BoxShape ( void  )
virtual

Destroys a box object.

Member Function Documentation

void TurtleBrains::Graphics::BoxShape::SetSize ( const float  width,
const float  height 
)

Moves the vertices of the box around to match.

Note
This will certainly destroy any anchor / origin offset that was initially applied to the shape. You will need to call SetOrigin again after calling this function.