#include <tb_graphic_list.h>
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) |
![]() | |
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) |
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 |
![]() | |
const Color & | GetColor (void) const |
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.
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 |
Destructs the GraphicList object, which does not clean up any resources associated with the Graphic objects that were added to the list with AddGraphic.
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().
|
overrideprotectedvirtual |
Calls Render() on each Graphic object contained in the list which will then call OnRender() if the object is visible.
Implements TurtleBrains::Graphics::Graphic.
Reimplemented in TurtleBrains::Game::Entity, TurtleBrains::Game::TileSystem, and TurtleBrains::Game::GameScene.
|
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 |
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.