TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
TurtleBrains::Graphics::GraphicList Class Reference

#include <tb_graphic_list.h>

Inheritance diagram for TurtleBrains::Graphics::GraphicList:
TurtleBrains::Graphics::Graphic TurtleBrains::Game::Entity TurtleBrains::Game::EntityManager TurtleBrains::Game::TileSystem TurtleBrains::Game::GameScene

Public Member Functions

 GraphicList (void)
 
virtual ~GraphicList (void)
 
void AddGraphic (Graphic *graphic)
 
void AddGraphic (Graphic &graphic)
 
void RemoveGraphic (Graphic *graphic)
 
virtual void SetColor (const tbGraphics::Color &newColor)
 
- 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)
 
float GetDepth (void) const
 
void SetDepth (const float newDepth)
 
bool IsRelative (void) const
 

Protected Member Functions

virtual void OnUpdate (const float deltaTime) override
 
virtual void OnRender (void) const override
 
- Protected Member Functions inherited from TurtleBrains::Graphics::Graphic
const ColorGetColor (void) const
 

Detailed Description

A GraphicList contains a list of Graphic objects to update and render when it gets updated or rendered. This creates a semi-structured way of contraining multiple Graphic objects. The GraphicList does not manage the memory or resources of the Graphic objects that are added to the list.

Constructor & Destructor Documentation

TurtleBrains::Graphics::GraphicList::GraphicList ( void  )

Constructs an empty list of Graphic objects. Use AddGraphic() to add Graphic objects to be updated and rendered by the GraphicList object.

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

Destructs the GraphicList object, which does not clean up any resources associated with the Graphic objects that were added to the list with AddGraphic.

Member Function Documentation

void TurtleBrains::Graphics::GraphicList::AddGraphic ( Graphic graphic)

Adds a Graphic to the list so it will be updated, if active, and rendered, if visible, whenever the object is updated or rendered. The memory for the graphic is NOT managed and must remain available until it is removed with RemoveGraphic().

void TurtleBrains::Graphics::GraphicList::AddGraphic ( Graphic graphic)

Adds a Graphic to the list so it will be updated, if active, and rendered, if visible, whenever the object is updated or rendered. The memory for the graphic is NOT managed and must remain available until it is removed with RemoveGraphic().

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

Calls Render() on each Graphic object contained in the list which will then call OnRender() if the object is visible.

Note
This will currently trigger an error condition if the Graphic object is not relative to the parent location as this feature is currently unimplemented. TODO: TIM: Implementation: Needs to be implemented.

Implements TurtleBrains::Graphics::Graphic.

Reimplemented in TurtleBrains::Game::Entity, TurtleBrains::Game::TileSystem, and TurtleBrains::Game::GameScene.

virtual void TurtleBrains::Graphics::GraphicList::OnUpdate ( const float  deltaTime)
overrideprotectedvirtual

Calls Update() on each Graphic object contained in the list which will then call OnUpdate() if the object is active.

Reimplemented from TurtleBrains::Graphics::Graphic.

Reimplemented in TurtleBrains::Game::Entity, TurtleBrains::Game::EntityManager, and TurtleBrains::Game::GameScene.

void TurtleBrains::Graphics::GraphicList::RemoveGraphic ( Graphic graphic)

Removes a Graphic from the list so it will no longer be updated or rendered. This will not clean up any memory or resources used by the graphic, but it was expected that the graphic remained available until it was removed.

virtual void TurtleBrains::Graphics::GraphicList::SetColor ( const tbGraphics::Color newColor)
virtual

Change the color of the sprite so it can fade in/out with alpha, or modify the color for other effects.

Reimplemented from TurtleBrains::Graphics::Graphic.