Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
|
An abstract base class for all ECS component arrays. More...
#include <ecs_world.hpp>
Public Member Functions | |
BaseComponentArray (std::weak_ptr< ECSWorld > world) | |
Construct a new Base Component Array object. | |
virtual | ~BaseComponentArray ()=default |
Destroy the Base Component Array object. | |
virtual void | handleEntityDestroyed (EntityID entityID)=0 |
A virtual function that handles the side-effect of destroying an entity, i.e., deleting its component in this array. | |
virtual void | handlePreSimulationStep ()=0 |
An unimplemented callback for a step that occurs before each simulation step. | |
virtual void | copyComponent (EntityID to, EntityID from)=0 |
Handles the copying of a component from one entity to another within the same array. | |
virtual void | copyComponent (EntityID to, EntityID from, BaseComponentArray &other)=0 |
Handles the copying of a component from one entity to another, where the other entity belongs to another ECS World. | |
virtual void | addComponent (EntityID to, const nlohmann::json &jsonComponent)=0 |
Constructs and adds a component to an array based on its json description. | |
virtual void | updateComponent (EntityID to, const nlohmann::json &jsonComponent)=0 |
Updates the component associated with an entity based on a json description of a new component. | |
virtual bool | hasComponent (EntityID entityID) const =0 |
Tests whether this array has an entry for this entity. | |
virtual void | removeComponent (EntityID entityID)=0 |
Removes the component associated with this entity, if present. | |
virtual std::shared_ptr< BaseComponentArray > | instantiate (std::weak_ptr< ECSWorld > world) const =0 |
Creates a fresh, empty component array and associates it with a new World. | |
Protected Attributes | |
std::weak_ptr< ECSWorld > | mWorld {} |
A reference to the world to which this component array belongs. | |
An abstract base class for all ECS component arrays.
A component array is a table containing a mapping from an entity to its component, whose type is defined in a subclass of BaseComponentArray
|
inlineexplicit |
Construct a new Base Component Array object.
world | a pointer to the this array will belong to once constructed |
|
pure virtual |
Constructs and adds a component to an array based on its json description.
to | The entity to which the new component will be associated |
jsonComponent | The component's description in json |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
Handles the copying of a component from one entity to another within the same array.
to | The entity which will receive the copied component |
from | The entity whose component is being copied |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
Handles the copying of a component from one entity to another, where the other entity belongs to another ECS World.
to | The entity which will receive the copied component |
from | The entity whose component is being copied |
other | The source component array which the entity from belongs to |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
A virtual function that handles the side-effect of destroying an entity, i.e., deleting its component in this array.
entityID | the ID of the entity being destroyed |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
An unimplemented callback for a step that occurs before each simulation step.
For component arrays, this is when you can expect the component values from the next
member array to be copied over into previous
.
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
Tests whether this array has an entry for this entity.
entityID | The entity whose component is being queried |
true | The component is present; |
false | The component is absent; |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
Creates a fresh, empty component array and associates it with a new World.
world | A pointer to the world the new component array will belong to |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
Removes the component associated with this entity, if present.
entityID | The entity whose component is being removed |
Implemented in ToyMaker::ComponentArray< TComponent >.
|
pure virtual |
Updates the component associated with an entity based on a json description of a new component.
to | The entity whose component is updated |
jsonComponent | The component's description in json |
Implemented in ToyMaker::ComponentArray< TComponent >.