Components

Components are the basic unit of data. They are used to store data but are also the set of prerequisites for a system to update them.

Using components :

Registering a component :

Engine engine;

engine.RegisterComponent<Position>();

Warning: Components must be registered before being used.

Unregistering a component :

engine.UnregisterComponent<Position>();

Adding a component to an entity :

engine.AddComponent(entity, Position{0, 0});

Getting a component from an entity :

auto &position = engine.GetComponent<Position>(entity);

Removing a component from an entity :

engine.RemoveComponent(entity);