Simple C++ Game
Public Member Functions | Protected Member Functions | List of all members
IteratingSystem Class Referenceabstract

An implementation of EntitySystem that iterates through all Entity objects in EntitySystem::getEntities() each EntitySystem::update. More...

#include <IteratingSystem.hpp>

Inheritance diagram for IteratingSystem:
Inheritance graph
[legend]
Collaboration diagram for IteratingSystem:
Collaboration graph
[legend]

Public Member Functions

 IteratingSystem ()
 Construct a new IteratingSystem with the default EntitySystem constructor. More...
 
 IteratingSystem (const std::shared_ptr< EntityFamily > &family)
 Construct a new IteratingSystem with the EntityFamily EntitySystem constructor. More...
 
void update (const sf::Time deltaTime)
 Iterates through each element in the system to perform updates. More...
 
- Public Member Functions inherited from EntitySystem
 EntitySystem ()
 Construct a new default EntitySystem. More...
 
 EntitySystem (const std::shared_ptr< EntityFamily > &family)
 Construct a new EntitySystem that acts on a specified family. More...
 
virtual void engineEntityAdded (const std::shared_ptr< Entity > &entity)
 Performs any operations required after an entity has been added to an EntityEngine the system is a part of. More...
 

Protected Member Functions

virtual void process (std::shared_ptr< Entity > &entity, sf::Time deltaTime)=0
 Processes a specific entity. More...
 
- Protected Member Functions inherited from EntitySystem
virtual std::map< int, std::shared_ptr< Entity > > getEntities () const
 Get the Entities in the system. More...
 

Detailed Description

An implementation of EntitySystem that iterates through all Entity objects in EntitySystem::getEntities() each EntitySystem::update.

Constructor & Destructor Documentation

◆ IteratingSystem() [1/2]

IteratingSystem::IteratingSystem ( )

Construct a new IteratingSystem with the default EntitySystem constructor.

See also
EntitySystem::EntitySystem()

◆ IteratingSystem() [2/2]

IteratingSystem::IteratingSystem ( const std::shared_ptr< EntityFamily > &  family)

Construct a new IteratingSystem with the EntityFamily EntitySystem constructor.

Parameters
familyThe family to provide to the EntitySystem constructor
See also
EntitySystem::EntitySystem(const std::shared_ptr<EntityFamily> &family)

Member Function Documentation

◆ process()

virtual void IteratingSystem::process ( std::shared_ptr< Entity > &  entity,
sf::Time  deltaTime 
)
protectedpure virtual

Processes a specific entity.

This method is pure virtual in IteratingSystem. It is up to sublcasses to implement their specific needs.

Parameters
entityThe current entity being processed.
deltaTimeThe amount of time that has passed since process() was last called for this entity.

Implemented in VelocitySystem, RenderSystem, PlayerInputSystem, BallSystem, and EnemyAISystem.

◆ update()

void IteratingSystem::update ( const sf::Time  deltaTime)
virtual

Iterates through each element in the system to perform updates.

For each element in EntitySystem::getEntities(), calls IteratingSystem::process.

Parameters
deltaTimeThe amount of time that has passed since this method was last called
See also
IteratingSystem::process(std::shared_ptr<Entity> &entity, sf::Time deltaTime)

Implements EntitySystem.


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