Managing systems

Finally, we've arrived at the last stop on the entity component system route: handling systems themselves. Let's quickly review our custom data types for this class:

using SystemContainer = std::unordered_map<System,S_Base*>;
using EntityEventContainer = std::unordered_map<
  EntityId,EventQueue>;

The first data type, SystemContainer, is really hard to misinterpret. An unordered map is used to link system identifiers to actual systems. The second type definition here is responsible for storage of entity events. It also uses an unordered map and links entity identifiers to EventQueue instances, that all hold events for a specific entity until they're processed.

It's time to design the system manager class:

class EntityManager; class ...

Get SFML Game Development By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.