Simple C++ Game
Public Member Functions | List of all members
EntityEngine Class Reference

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...
 

Detailed Description

A engine for handling a component entity system.

Member Function Documentation

◆ add() [1/2]

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

Parameters
entitythe entity to add to the engine

◆ add() [2/2]

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().

Parameters
systemthe system to be added to the engine

◆ update()

void EntityEngine::update ( const sf::Time  deltaTime)

Updates all systems in the engine.

Parameters
deltaTimeThe amount of time that has passed since the last update.
See also
EntitySystem::update

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