15 #ifndef CORGI_COMPONENT_INTERFACE_H_
16 #define CORGI_COMPONENT_INTERFACE_H_
62 typedef std::unique_ptr<uint8_t, std::function<void(uint8_t*)>>
127 virtual void Init() = 0;
189 #endif // CORGI_COMPONENT_INTERFACE_H_
std::unique_ptr< uint8_t, std::function< void(uint8_t *)> > RawDataUniquePtr
A pointer type for exported raw data.
Definition: component_interface.h:63
virtual void * GetComponentDataAsVoid(const EntityRef &)=0
Gets the data for a given Entity as a void pointer.
virtual bool HasDataForEntity(const EntityRef &)=0
Returns true if this component has data associated with the entity provided.
virtual void ClearComponentData()=0
Clears all Component data, effectively disassociating this Component from any Entities.
The EntityManager is the code that manages all Entities and Components in the game. Normally the game will instantiate EntityManager, and then use it to create and control all of its Entities.
Definition: entity_manager.h:61
int WorldTime
A typedef that represents time in the game.
Definition: entity_common.h:49
virtual void UpdateAllEntities(WorldTime delta_time)=0
Update all Entities that contain this Component.
virtual void AddFromRawData(EntityRef &entity, const void *data)=0
Creates and populates an Entity from raw data. Components that want to be able to be constructed via ...
virtual ~ComponentInterface()
A destructor for the Component interface.
Definition: component_interface.h:66
virtual void SetEntityManager(EntityManager *entity_manager)=0
Set the EntityManager for this Component. Usually this is assigned by the EntityManager itself...
A pool allocator, implemented as a vector-based pair of linked lists.
Definition: vector_pool.h:43
VectorPool< corgi::Entity >::VectorPoolReference EntityRef
A typedef that should be used as the primary way to reference an Entity.
Definition: component_interface.h:49
virtual void RemoveEntity(EntityRef &entity)=0
Remove an Entity from the Component's list.
virtual void Init()=0
This function is called after the Component is added to the EntityManager. (i.e. This typically happe...
A reference object for pointing into the vector pool. It acts as a pointer for vector pool elements a...
Definition: vector_pool.h:72
virtual RawDataUniquePtr ExportRawData(const EntityRef &entity) const =0
Serializes a Component's data for a specific Entity.
virtual void InitEntity(EntityRef &entity)=0
Called by the EntityManager every time an Entity is added to this Component.
virtual void SetComponentIdOnDataType(ComponentId id)=0
Sets the Component ID for the data type.
virtual void AddEntityGenerically(EntityRef &entity)=0
Add an Entity to the Component.
uint16_t ComponentId
This represents the ID of a Component.
Definition: entity_common.h:36
virtual void Cleanup()=0
Called just before removal from the EntityManager. (i.e. Usually when the game/state is over and ever...
An interface that provides basic Component functionality. All Components will inherit from this class...
Definition: component_interface.h:57
virtual void CleanupEntity(EntityRef &entity)=0
Called when the Entity is being removed from the Component. Components should implement this if they ...