December 2015
Beginner to intermediate
522 pages
11h 21m
English
Now that we have the building blocks of entities defined, it's time to talk about storing and managing them. As mentioned previously, all an entity is at this point is a single identifier. Knowing that, we can begin shaping the way this data is going to be stored, beginning, as always, with the definition of data types to be used:
using EntityId = unsigned int; using ComponentContainer = std::vector<C_Base*>; using EntityData = std::pair<Bitmask,ComponentContainer>; using EntityContainer = std::unordered_map<EntityId,EntityData>; using ComponentFactory = std::unordered_map< Component,std::function<C_Base*(void)>>;
The first data type we'll be working with is the entity identifier, once again represented by an unsigned integer. ...
Read now
Unlock full access