Simple C++ Game
|
A engine for handling a component entity system. More...
#include <EntityEngine.hpp>
Public Member Functions | |
void | add (std::shared_ptr< EntitySystem > system) |
Adds a system to the engine. More... | |
void | add (std::shared_ptr< Entity > entity) |
Adds an entity to the engine. More... | |
void | update (const sf::Time deltaTime) |
Updates all systems in the engine. More... | |
A engine for handling a component entity system.
void EntityEngine::add | ( | std::shared_ptr< Entity > | entity | ) |
Adds an entity to the engine.
Adds the provided entity to the engine. The call site, the engine, and any systems that choose to will share ownership of the entity through copies of the shared_ptr. Systems will only be informed of the addition of an entity if EntityEngine::add(std::shared_ptr<Entity> entity) is called after EntityEngine::add(std::shared_ptr<EntitySystem> system), so take care with ordering calls during initialization
entity | the entity to add to the engine |
void EntityEngine::add | ( | std::shared_ptr< EntitySystem > | system | ) |
Adds a system to the engine.
Adds the provided system to the engine. The call site and the engine will share ownership of the system through the shared_ptr created by the copy constructor when calling this method. Systems will have update() called on them each frame in the same order they are added to the engine, so if processing order is important, care should be taken when organizing calls to add().
system | the system to be added to the engine |
void EntityEngine::update | ( | const sf::Time | deltaTime | ) |
Updates all systems in the engine.
deltaTime | The amount of time that has passed since the last update. |