CORGI
An open source project by
FPL.
|
The Entity Manager is an object that coordinates the entity-component system. It is intended to act as the main point of interface for game logic to create Entities and register them with Components.
At the basic level, once it has been initialized and all the Components have been registered, then the game can simply call EntityManager::UpdateComponents()
once per frame.
You must register each Component in your game with the Entity Manager by calling EntityManager::RegisterComponent<T>()
.
Note: The order that you register Components with the EntityManager is the order that they will be executed in.
You can create entities with a call to EntityManager::AllocateNewEntity()
. It returns a pointer to the newly allocated Entity as an EntityRef typedef.
You can interchangeably add Entities to Components. This is done with a call to EntityManager::AddEntityToComponent<T>()
.
Once you have registered your Components with your Entity Manager and added your Entities to your Components, then you just need to call EntityManager::UpdateComponents()
once per frame with the delta_time
since the last update.