The SimSystem is a system responsible for providing scriptability via SimObjects and SimObjectAspects.
More...
#include <sim_system.hpp>
|
static std::string | getSystemTypeName () |
| Gets the system type string associated with this system.
|
|
|
virtual std::shared_ptr< BaseSystem > | instantiate (std::weak_ptr< ECSWorld > world) override |
|
|
template<typename TSimObjectAspect> |
void | registerAspect () |
| Registers a new aspect (a derived class of SimObjectAspect) as an aspect known by the SimSystem.
|
|
std::shared_ptr< BaseSimObjectAspect > | constructAspect (const nlohmann::json &jsonAspectProperties) |
| Constructs a SimObjectAspect based on its description in JSON.
|
|
void | onSimulationStep (uint32_t simulationStepMillis) override |
| The method responsible for forwarding engine simulation step events to SimObjects and their SimObjectAspects.
|
|
void | onVariableStep (float simulationProgress, uint32_t variableStepMillis) override |
| The method responsible for forwarding engine variable step events to SimObjects and their SimObjectAspects.
|
|
|
std::unordered_map< std::string, std::shared_ptr< BaseSimObjectAspect >(*)(const nlohmann::json &jsonAspectProperties)> | mAspectConstructors {} |
| A database for all constructors of SimObjectAspects, provided by the implementation of the aspects themselves.
|
|
|
class | BaseSimObjectAspect |
|
class | SimObject |
|
The SimSystem is a system responsible for providing scriptability via SimObjects and SimObjectAspects.
A developer creates a subclass of SimObjectAspect, which can then be attached to a SimObject in the game either through the scene file or programmatically during the application's running.
The SimSystem then forwards scene object related lifecycle events and engine-loop events to active and interested SimObjectAspect subclasses.
◆ aspectRegistered()
bool SimSystem::aspectRegistered |
( |
const std::string & | aspectName | ) |
const |
Tests whether an aspect with a certain name is a valid SimObjectAspect type known by this application's SimSystem.
- Parameters
-
aspectName | The name of the aspect. |
- Return values
-
true | This aspect has been registered with the SimSystem; |
false | This aspect has not yet been registered with the SimSystem; |
◆ constructAspect()
std::shared_ptr< BaseSimObjectAspect > SimSystem::constructAspect |
( |
const nlohmann::json & | jsonAspectProperties | ) |
|
|
private |
Constructs a SimObjectAspect based on its description in JSON.
- Parameters
-
jsonAspectProperties | The aspect's JSON description, including its type and initial value. |
- Returns
- std::shared_ptr<BaseSimObjectAspect> [A base class pointer to] The newly constructed SimObjectAspect.
◆ getSystemTypeName()
static std::string ToyMaker::SimSystem::getSystemTypeName |
( |
| ) |
|
|
inlinestatic |
Gets the system type string associated with this system.
- Returns
- std::string The system type string associated with this system.
◆ onSimulationStep()
void SimSystem::onSimulationStep |
( |
uint32_t | simulationStepMillis | ) |
|
|
overrideprivate |
The method responsible for forwarding engine simulation step events to SimObjects and their SimObjectAspects.
- Parameters
-
simulationStepMillis | The time by which the simulation should be advanced, in milliseconds. |
◆ onVariableStep()
void SimSystem::onVariableStep |
( |
float | simulationProgress, |
|
|
uint32_t | variableStepMillis ) |
|
overrideprivate |
The method responsible for forwarding engine variable step events to SimObjects and their SimObjectAspects.
- Parameters
-
simulationProgress | The progress towards the next simulation step after the end of the next simulation step as a number between 0 and 1. |
variableStepMillis | The time since the computation of the last variable step. |
◆ registerAspect()
template<typename TSimObjectAspect>
void ToyMaker::SimSystem::registerAspect |
( |
| ) |
|
|
private |
Registers a new aspect (a derived class of SimObjectAspect) as an aspect known by the SimSystem.
- Template Parameters
-
TSimObjectAspect | The type of the new aspect. |
The documentation for this class was generated from the following files: