Simple C++ Game
EntitySystem.hpp
1 #pragma once
2 
3 #include <Entity.hpp>
4 #include <EntityFamily.hpp>
5 
6 #include <SFML/System.hpp>
7 
8 #include <memory>
9 #include <map>
10 
11 // TODO: Refactor family filtering logic to a FilteredEntitySystem class.
18 {
19 public:
27 
34  EntitySystem(const std::shared_ptr<EntityFamily> &family);
35 
44  virtual void engineEntityAdded(const std::shared_ptr<Entity> &entity);
45 
53  virtual void update(const sf::Time deltaTime) = 0;
54 
55 protected:
62  virtual std::map<int, std::shared_ptr<Entity>> getEntities() const;
63 
64 private:
65  std::shared_ptr<EntityFamily> _family;
66  std::map<int, std::shared_ptr<Entity>> _entities;
67 };
A class representing a system that processes groups of Entity in an EntityEngine.
Definition: EntitySystem.hpp:18
virtual void update(const sf::Time deltaTime)=0
Performs any operations necessary in routine processing.
virtual std::map< int, std::shared_ptr< Entity > > getEntities() const
Get the Entities in the system.
EntitySystem(const std::shared_ptr< EntityFamily > &family)
Construct a new EntitySystem that acts on a specified family.
EntitySystem()
Construct a new default EntitySystem.
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 pa...