Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
|
The base class that acts as the interface between the engine's ECS system and a particular built-in or user-defined System. More...
#include <ecs_world.hpp>
Public Member Functions | |
BaseSystem (std::weak_ptr< ECSWorld > world) | |
Construct a new Base System object. | |
virtual | ~BaseSystem ()=default |
Destroy the Base System object. | |
virtual bool | isSingleton () const |
A method to query whether a particular System is a singleton, or is instantiated for each world in the project. | |
Protected Member Functions | |
const std::set< EntityID > & | getEnabledEntities () |
Get a set of all entities that are influenced by this System. | |
template<typename TComponent, typename TSystem> | |
TComponent | getComponent_ (EntityID entityID, float progress=1.f) const |
The actual implementation of getComponent for a system. | |
template<typename TComponent, typename TSystem> | |
void | updateComponent_ (EntityID entityID, const TComponent &component) |
The actual implementation of updateComponent for a system. | |
bool | isEnabled (EntityID entityID) const |
Tests whether a particular entity is active for this system. | |
bool | isRegistered (EntityID entityID) const |
Tests whether a particular entity can be influenced by this system. | |
virtual std::shared_ptr< BaseSystem > | instantiate (std::weak_ptr< ECSWorld > world)=0 |
Creates a fresh copy of this system and associates it with a new ECS World, using this system as its template. | |
Protected Attributes | |
std::weak_ptr< ECSWorld > | mWorld |
A reference to the world this system belongs to. | |
Private Member Functions | |
void | addEntity (EntityID entityID, bool enabled=true) |
Adds an entity to this system. | |
void | removeEntity (EntityID entityID) |
Removes an entity from this system. | |
void | enableEntity (EntityID entityID) |
Allows a registered entity to be influenced by this system. | |
void | disableEntity (EntityID entityID) |
Prevents the influencing of an entity by this system. | |
virtual void | onEntityEnabled (EntityID entityID) |
An overridable callback for when an entity has been enabled. | |
virtual void | onEntityDisabled (EntityID entityID) |
An overridable callback for when an entity has been disabled. | |
virtual void | onEntityUpdated (EntityID entityID) |
An overridable callback for when another system has updated a component shared by this system and an entity. | |
virtual void | onInitialize () |
An overridable callback for right after an ECS world has just been created. | |
virtual void | onSimulationActivated () |
An overridable callback for right after the ECS World has been activated. | |
virtual void | onSimulationPreStep (uint32_t simStepMillis) |
An overridable callback called once at the beginning of every simulation step in the game loop. | |
virtual void | onSimulationStep (uint32_t simStepMillis) |
An overridable callback called once in the middle of every simulation step. | |
virtual void | onSimulationPostStep (uint32_t simStepMillis) |
An overridable callback called once at the end of this simulation step, and after related transform updates are applied. | |
virtual void | onPostTransformUpdate (uint32_t timeStepMillis) |
An overridable callback called after all the transforms in the scene are updated by the scene system. | |
virtual void | onVariableStep (float simulationProgress, uint32_t variableStepMillis) |
Overridable callback called after all simulation updates (if any) for the current frame have been completed. | |
virtual void | onPreRenderStep (float simulationProgress) |
Overridable callback called just before the render step takes place. | |
virtual void | onPostRenderStep (float simulationProgress) |
Overridable callback called just after the render step takes place. | |
virtual void | onSimulationDeactivated () |
Overridable callback called just after the ECS world owning this system has been deactivated. | |
virtual void | onDestroyed () |
Overridable callback called just before this system is destroyed. | |
Private Attributes | |
std::set< EntityID > | mEnabledEntities {} |
A set of all entities that are actively influenced by this system, managed by this system's ECS world. | |
std::set< EntityID > | mDisabledEntities {} |
A set of all entities that are compatible with this system, but have not been enabled for it. | |
Friends | |
class | SystemManager |
class | ECSWorld |
The base class that acts as the interface between the engine's ECS system and a particular built-in or user-defined System.
|
inline |
|
private |
Adds an entity to this system.
entityID | The entity being added. |
enabled | Whether the entity should be influenced by this system after being added. |
|
private |
Prevents the influencing of an entity by this system.
entityID | The entity being disabled for this system. |
|
private |
Allows a registered entity to be influenced by this system.
entityID | The entity being enabled for this system. |
|
protected |
The actual implementation of getComponent for a system.
TComponent | The type of component being retrieved. |
TSystem | The system for which the component is retrieved. |
entityID | The entity that owns the component. |
progress | The progress (0-1) between the previous sim tick and the next sim tick. |
|
protected |
Get a set of all entities that are influenced by this System.
|
protectedpure virtual |
Creates a fresh copy of this system and associates it with a new ECS World, using this system as its template.
world | The world the new system will be associated with. |
Implemented in ToyMaker::System< TSystemDerived, std::tuple< TListenedForComponents... >, std::tuple< TRequiredComponents... > >.
|
protected |
Tests whether a particular entity is active for this system.
entityID | The entity being queried. |
true | Indicates that the entity is influenced by this system; |
false | Indicates that the entity is not influenced by this system; |
|
protected |
Tests whether a particular entity can be influenced by this system.
entityID | The entity being queried. |
true | Indicates that the entity's component signature matches this system's component signature; |
false | Indicates that the component signatures do not match; |
|
inlinevirtual |
A method to query whether a particular System is a singleton, or is instantiated for each world in the project.
true | This system is a singleton, and manages entities across worlds; |
false | This system belongs to the world it is a part of, and is instantiated once for each world; |
|
inlineprivatevirtual |
Overridable callback called just before this system is destroyed.
Useful if this system has some special bookkeeping it needs to perform before it is retired.
|
inlineprivatevirtual |
An overridable callback for when an entity has been disabled.
Useful if the system has related bookkeeping of its own that it would need to update in such an event.
entityID | The disabled entity. |
|
inlineprivatevirtual |
An overridable callback for when an entity has been enabled.
Useful if the system has related bookkeeping of its own that it would need to update in such an event.
entityID | The enabled entity. |
|
inlineprivatevirtual |
An overridable callback for when another system has updated a component shared by this system and an entity.
entityID | The updated entity. |
|
inlineprivatevirtual |
Overridable callback called just after the render step takes place.
simulationProgress | The progress towards the next simulation step as a value between 0.0 and 1.0, calculated using time since last simulation step / (time of next simulation step - time of last simulation step ) |
|
inlineprivatevirtual |
An overridable callback called after all the transforms in the scene are updated by the scene system.
timeStepMillis | The time by which the simulation must be moved forward. |
|
inlineprivatevirtual |
Overridable callback called just before the render step takes place.
simulationProgress | The progress towards the next simulation step as a value between 0.0 and 1.0, calculated using time since last simulation step / (time of next simulation step - time of last simulation step ) |
|
inlineprivatevirtual |
Overridable callback called just after the ECS world owning this system has been deactivated.
Required if this system has some special bookkeeping it needs to perform before it is suspended.
|
inlineprivatevirtual |
An overridable callback called once at the end of this simulation step, and after related transform updates are applied.
simStepMillis | The time by which the simulation must be moved forward. |
|
inlineprivatevirtual |
An overridable callback called once at the beginning of every simulation step in the game loop.
simStepMillis | The time by which the simulation must be moved forward. |
|
inlineprivatevirtual |
An overridable callback called once in the middle of every simulation step.
The simulation step is the same regardless of time that has elapsed since the last frame. If a lot of time has passed, multiple simulation steps are computed in this frame, and conversely if very little time has passed, no simulation step is computed this frame.
simStepMillis | The time by which the simulation must be moved forward. |
|
inlineprivatevirtual |
Overridable callback called after all simulation updates (if any) for the current frame have been completed.
May be called multiple times between two simulation frames, or once every couple of simulation frames, depending on the cability of the current computer and operations being performed on it simultaneously.
simulationProgress | The progress towards the next simulation step as a value between 0.0 and 1.0, calculated using time since last simulation step / (time of next simulation step - time of last simulation step ) |
variableStepMillis | The real time that has passed since the computation of the last frame (NOT the last simulation step). |
|
private |
Removes an entity from this system.
entityID | The entity being removed. |
|
protected |
The actual implementation of updateComponent for a system.
TComponent | The type of component being updated. |
TSystem | The system triggering the update. |
entityID | The entity that owns the component. |
component | The new value of the component after the update. |