libes
0.5.3
an Entity System library for C++
|
A local system. More...
#include <es/LocalSystem.h>
Public Member Functions | |
LocalSystem (int priority, std::set< ComponentType > needed, Manager *manager, int width, int height) | |
Create a local system. More... | |
virtual void | update (float delta) |
Update all the entities in the current time step. More... | |
virtual void | updateEntity (float delta, Entity e) |
Update an entity in the current time step. More... | |
void | reset (int width, int height) |
Reset the grid dimensions. More... | |
void | setFocus (int x, int y) |
Set the focus for local systems. More... | |
bool | addLocalEntity (Entity e, int x, int y) |
Add an entity in the (x,y) cell of the grid. More... | |
bool | removeLocalEntity (Entity e, int x, int y) |
Remove an entity from the (x,y) cell of the grid. 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< ComponentType > | getNeededComponents () const |
Get the needed component types. More... | |
Manager * | getManager () |
Get the manager. More... | |
virtual bool | addEntity (Entity e)=0 |
Add an entity in the system. More... | |
virtual bool | removeEntity (Entity e)=0 |
Removes an entity from the system. 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... | |
A local system.
A local system handles the entities in a rectangular grid and updates the entities that are in the focused cell.
|
inline |
Create a local system.
priority | the priority of the system (small priority will be executed first) |
needed | the set of needed component types that an entity must have to be handled properly by this system |
manager | the manager (that is saved in the system so that the system can easily access the manager) |
width | the width of the grid |
height | the height of the grid |
bool es::LocalSystem::addLocalEntity | ( | Entity | e, |
int | x, | ||
int | y | ||
) |
Add an entity in the (x,y) cell of the grid.
e | the entity |
x | the x coordinate |
y | the y coordinate |
bool es::LocalSystem::removeLocalEntity | ( | Entity | e, |
int | x, | ||
int | y | ||
) |
Remove an entity from the (x,y) cell of the grid.
e | the entity |
x | the x coordinate |
y | the y coordinate |
void es::LocalSystem::reset | ( | int | width, |
int | height | ||
) |
Reset the grid dimensions.
width | the width of the grid |
height | the height of the grid |
|
inline |
Set the focus for local systems.
x | the x-coordinate of the focus |
y | the y-coordinate of the focus |
|
virtual |
Update all the entities in the current time step.
delta | the time (in second) since the last update |
Reimplemented from es::System.
|
virtual |
Update an entity in the current time step.
This function is called by update. By default, do nothing.
delta | the time (in second) since the last update |
e | the entity |