#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) override |
![]() | |
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) |
void | SetOrigin (const float originX, const float originY) |
float | GetDepth (void) const |
void | SetDepth (const float newDepth) |
void | SetScale (const float scale) |
void | SetScale (const float scaleX, const float scaleY) |
void | SetRotation (const float rotation) |
float | GetRotation (void) const |
void | SetScroll (const float scroll) |
void | SetScroll (const float scrollX, const float scrollY) |
bool | IsRelative (void) const |
virtual PixelSpace | GetPixelWidth (void) const |
virtual PixelSpace | GetPixelHeight (void) const |
float | GetWidth (void) const |
float | GetHeight (void) const |
Protected Member Functions | |
virtual void | OnUpdate (const float deltaTime) override |
virtual void | OnRender (void) const override |
![]() | |
const Color & | GetColor (void) const |
virtual void | ApplyTransform (void) const |
virtual void | PopTransform (void) const |
A GraphicList is a container of Graphic objects that get updated and rendered when the GraphicList gets updated or rendered. The contained Graphic objects are sorted and updated/rendered based on their depth in the scene. Depending on how the Graphic object is added to the GraphicList, the memory may also be deleted. See the difference between AddGraphic(Graphic&) and AddGraphic(Graphic*).
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 managed and delete graphic; will be called when either the GraphicList is destroyed or the Graphic 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 and in scope until it is removed with RemoveGraphic(). The GraphicList will not 'own' a Graphic added this way.
|
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, 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 only clean up memory or resources used by the graphic if added with AddGraphic(Graphic*), but those added with AddGraphic(Graphic&) are expected that the graphic remained available until it was removed.
|
overridevirtual |
Changes the color of all the Graphic objects in the GraphicList.
Reimplemented from TurtleBrains::Graphics::Graphic.