TouchCPLib  1.0.0
A touch-enabled GUI interface based on SDL and libTS. It provides a simple desktop-free UI for your embedded Raspberry projects.
GraphicsScene Class Reference

The Scene object is a base class to construct a Scene upon. The scene is basically a view that can be swapped at runtime with other scenes. It is supposed to contain other Graphic Objects inside of it, since it won't draw anything on its own. The draw method is simply calling the draw method for each child object. More...

#include <GraphicsScene.h>

Inheritance diagram for GraphicsScene:
Collaboration diagram for GraphicsScene:

Public Member Functions

 GraphicsScene ()
 
 GraphicsScene (const GraphicsScene &copy)=delete
 
 GraphicsScene (const GraphicsScene &&move)=delete
 
GraphicsScene operator= (const GraphicsScene &copy)=delete
 
virtual ~GraphicsScene ()
 
const std::vector< GraphicsObject * > getObjects () const
 
void addObject (GraphicsObject *object)
 Add an object to the scene. *** Once added, the object is bound to the scene and it will take care of deleting the object when destroyed ***. More...
 
void addObjects (GraphicsObject **toadd, size_t number)
 Add an array of objects to the scene. More...
 
void addObjects (const std::vector< GraphicsObject *> &toadd)
 Add a vector of objects. More...
 
void removeObject (GraphicsObject *toremove)
 Removes an object from the scene. *** You take ownership of the object back, so the scene won't delete it anymore ***. More...
 
void removeObject (int index)
 Removes an object at the given index. More...
 
void clearObjects ()
 Removes all the objects from the scene, taking ownership back on them. More...
 
void draw (uint32_t time) override
 The draw method. It will be called once per frame for each object in a scene. More...
 
void show ()
 
- Public Member Functions inherited from GraphicsObject
virtual ~GraphicsObject ()=default
 
bool isVisible () const
 
void setVisibility (bool visible)
 

Detailed Description

The Scene object is a base class to construct a Scene upon. The scene is basically a view that can be swapped at runtime with other scenes. It is supposed to contain other Graphic Objects inside of it, since it won't draw anything on its own. The draw method is simply calling the draw method for each child object.

Constructor & Destructor Documentation

◆ GraphicsScene() [1/3]

GraphicsScene::GraphicsScene ( )

◆ GraphicsScene() [2/3]

GraphicsScene::GraphicsScene ( const GraphicsScene copy)
delete

◆ GraphicsScene() [3/3]

GraphicsScene::GraphicsScene ( const GraphicsScene &&  move)
delete

◆ ~GraphicsScene()

GraphicsScene::~GraphicsScene ( )
virtual

Member Function Documentation

◆ addObject()

void GraphicsScene::addObject ( GraphicsObject object)

Add an object to the scene. *** Once added, the object is bound to the scene and it will take care of deleting the object when destroyed ***.

Parameters
objectThe object to add

◆ addObjects() [1/2]

void GraphicsScene::addObjects ( GraphicsObject **  toadd,
size_t  number 
)

Add an array of objects to the scene.

Parameters
toaddThe array of objects
numberThe number of objects

◆ addObjects() [2/2]

void GraphicsScene::addObjects ( const std::vector< GraphicsObject *> &  toadd)

Add a vector of objects.

Parameters
toaddThe vector of objects

◆ clearObjects()

void GraphicsScene::clearObjects ( )

Removes all the objects from the scene, taking ownership back on them.

◆ draw()

void GraphicsScene::draw ( uint32_t  time)
overridevirtual

The draw method. It will be called once per frame for each object in a scene.

Parameters
timeA time parameter (as given by SDL_GetTicks) for time-based animation purposes

Implements GraphicsObject.

◆ getObjects()

const std::vector< GraphicsObject * > GraphicsScene::getObjects ( ) const

◆ operator=()

GraphicsScene GraphicsScene::operator= ( const GraphicsScene copy)
delete

◆ removeObject() [1/2]

void GraphicsScene::removeObject ( GraphicsObject toremove)

Removes an object from the scene. *** You take ownership of the object back, so the scene won't delete it anymore ***.

Parameters
toremoveThe object to remove

◆ removeObject() [2/2]

void GraphicsScene::removeObject ( int  index)

Removes an object at the given index.

Parameters
indexThe inner index of the object

◆ show()

void GraphicsScene::show ( )

The documentation for this class was generated from the following files: