libes  0.5.3
an Entity System library for C++
Public Member Functions | List of all members
es::GlobalSystem Class Reference

A global system. More...

#include <es/GlobalSystem.h>

Inheritance diagram for es::GlobalSystem:
Inheritance graph
[legend]

Public Member Functions

 GlobalSystem (int priority, std::set< ComponentType > needed, Manager *manager)
 Create a global system. More...
 
virtual void update (float delta) override
 Update all the entities in the current time step. More...
 
virtual bool addEntity (Entity e) override
 Add an entity in the system. More...
 
virtual bool removeEntity (Entity e) override
 Removes an entity from the system. More...
 
virtual void updateEntity (float delta, Entity e)
 Update an entity in the current time step. More...
 
- Public Member Functions inherited from es::System
 System (int priority, std::set< ComponentType > needed, Manager *manager)
 A system constructor. More...
 
virtual ~System ()
 
int getPriority () const
 Get the priority of the system. More...
 
std::set< ComponentTypegetNeededComponents () const
 Get the needed component types. More...
 
ManagergetManager ()
 Get the manager. More...
 
virtual void init ()
 Initialize the system. More...
 
virtual void preUpdate (float delta)
 Do something before the individual update of each entity. More...
 
virtual void postUpdate (float delta)
 Do something after the individual update of each entity. More...
 

Detailed Description

A global system.

A global system is a System that handles entities globally, as a set.

Constructor & Destructor Documentation

es::GlobalSystem::GlobalSystem ( int  priority,
std::set< ComponentType needed,
Manager manager 
)
inline

Create a global system.

Parameters
prioritythe priority of the system (small priority will be executed first)
neededthe set of needed component types that an entity must have to be handled properly by this system
managerthe manager (that is saved in the system so that the system can easily access the manager)

Member Function Documentation

virtual bool es::GlobalSystem::addEntity ( Entity  e)
overridevirtual

Add an entity in the system.

The entity must have the needed components (this is not verified by the library). The order in which the entity are added is not saved.

Parameters
ethe entity
Returns
true if the entity was actually added

Implements es::System.

virtual bool es::GlobalSystem::removeEntity ( Entity  e)
overridevirtual

Removes an entity from the system.

Parameters
ethe entity
Returns
true if the entity was actually removed

Implements es::System.

virtual void es::GlobalSystem::update ( float  delta)
overridevirtual

Update all the entities in the current time step.

Parameters
deltathe time (in second) since the last update

Reimplemented from es::System.

virtual void es::GlobalSystem::updateEntity ( float  delta,
Entity  e 
)
virtual

Update an entity in the current time step.

This function is called by update. By default, do nothing.

Parameters
deltathe time (in second) since the last update
ethe entity