CORGI
An open source project by
FPL.
|
An interface that provides basic Component functionality. All Components will inherit from this class. It provides the minimum set of things that are uniform across all Components (without needing to know the specific type of Component that it is). More...
#include <component_interface.h>
Inherited by corgi::Component< AnimationData >, corgi::Component< CommonServicesData >, corgi::Component< GraphData >, corgi::Component< MetaData >, corgi::Component< PhysicsData >, corgi::Component< RenderMeshData >, corgi::Component< TransformData >, and corgi::Component< T >.
An interface that provides basic Component functionality. All Components will inherit from this class. It provides the minimum set of things that are uniform across all Components (without needing to know the specific type of Component that it is).
Public Types | |
typedef std::unique_ptr < uint8_t, std::function< void(uint8_t *)> > | RawDataUniquePtr |
A pointer type for exported raw data. | |
Public Member Functions | |
virtual | ~ComponentInterface () |
A destructor for the Component interface. | |
virtual void | AddEntityGenerically (EntityRef &entity)=0 |
Add an Entity to the Component. More... | |
virtual void | RemoveEntity (EntityRef &entity)=0 |
Remove an Entity from the Component's list. More... | |
virtual void | UpdateAllEntities (WorldTime delta_time)=0 |
Update all Entities that contain this Component. More... | |
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. | |
virtual void * | GetComponentDataAsVoid (const EntityRef &)=0 |
Gets the data for a given Entity as a void pointer. More... | |
virtual const void * | GetComponentDataAsVoid (const EntityRef &) const =0 |
Gets the data for a given ntity as a const void pointer. More... | |
virtual void | Init ()=0 |
This function is called after the Component is added to the EntityManager. (i.e. This typically happens once, at the beginning of the game before any Entities are added.) | |
virtual void | InitEntity (EntityRef &entity)=0 |
Called by the EntityManager every time an Entity is added to this Component. More... | |
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 the EntityFactory need to implement this. More... | |
virtual RawDataUniquePtr | ExportRawData (const EntityRef &entity) const =0 |
Serializes a Component's data for a specific Entity. More... | |
virtual void | Cleanup ()=0 |
Called just before removal from the EntityManager. (i.e. Usually when the game/state is over and everything is shutting down.) | |
virtual void | CleanupEntity (EntityRef &entity)=0 |
Called when the Entity is being removed from the Component. Components should implement this if they need to perform any cleanup on the Entity data. More... | |
virtual void | SetEntityManager (EntityManager *entity_manager)=0 |
Set the EntityManager for this Component. Usually this is assigned by the EntityManager itself. More... | |
virtual void | SetComponentIdOnDataType (ComponentId id)=0 |
Sets the Component ID for the data type. More... | |
|
pure virtual |
Add an Entity to the Component.
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, and corgi::Component< GraphData >.
|
pure virtual |
Creates and populates an Entity from raw data. Components that want to be able to be constructed via the EntityFactory need to implement this.
[in,out] | entity | An EntityRef that points to an Entity that is being added from the raw data. |
[in] | data | A void pointer to the raw data. |
Implemented in PhysicsComponent, corgi::component_library::RenderMeshComponent, corgi::component_library::TransformComponent, corgi::component_library::GraphComponent, corgi::component_library::AnimationComponent, corgi::component_library::CommonServicesComponent, and corgi::component_library::MetaComponent.
|
pure virtual |
Called when the Entity is being removed from the Component. Components should implement this if they need to perform any cleanup on the Entity data.
[in] | entity | An EntityRef reference to the Entity that is being removed and may need to be cleaned up. |
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, corgi::Component< GraphData >, PhysicsComponent, corgi::component_library::TransformComponent, and corgi::component_library::MetaComponent.
|
pure virtual |
Serializes a Component's data for a specific Entity.
If you do not support this functionality, this function should return a nullptr.
[in] | entity | An EntityRef reference to an Entity whose raw data should be returned. |
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, corgi::Component< GraphData >, PhysicsComponent, corgi::component_library::RenderMeshComponent, corgi::component_library::TransformComponent, corgi::component_library::GraphComponent, corgi::component_library::AnimationComponent, and corgi::component_library::MetaComponent.
|
pure virtual |
Gets the data for a given Entity as a void pointer.
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, and corgi::Component< GraphData >.
|
pure virtual |
Gets the data for a given ntity as a const void pointer.
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, and corgi::Component< GraphData >.
|
pure virtual |
Called by the EntityManager every time an Entity is added to this Component.
[in] | entity | An EntityRef pointing to an Entity that is being added to this Component and may need initialized. |
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, corgi::Component< GraphData >, PhysicsComponent, corgi::component_library::RenderMeshComponent, corgi::component_library::TransformComponent, and corgi::component_library::MetaComponent.
|
pure virtual |
Remove an Entity from the Component's list.
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, and corgi::Component< GraphData >.
|
pure virtual |
Sets the Component ID for the data type.
[in] | id | The Component ID to set for the data type. |
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, and corgi::Component< GraphData >.
|
pure virtual |
Set the EntityManager for this Component. Usually this is assigned by the EntityManager itself.
[in] | entity_manager | A pointer to an EntityManager to associate with this Component. |
Implemented in corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, and corgi::Component< GraphData >.
|
pure virtual |
Update all Entities that contain this Component.
[in] | delta_time | A WorldTime corresponding to the delta time for this frame. |
Implemented in PhysicsComponent, corgi::component_library::RenderMeshComponent, corgi::component_library::TransformComponent, corgi::Component< T >, corgi::Component< CommonServicesData >, corgi::Component< PhysicsData >, corgi::Component< TransformData >, corgi::Component< AnimationData >, corgi::Component< MetaData >, corgi::Component< RenderMeshData >, corgi::Component< GraphData >, corgi::component_library::GraphComponent, corgi::component_library::MetaComponent, and corgi::component_library::AnimationComponent.