|
Thrive
|
A system handles one specific part of the game. More...
#include <system.h>
Classes | |
| struct | Implementation |
Public Member Functions | |
| System () | |
| Constructor. | |
| virtual | ~System ()=0 |
| Destructor. | |
| virtual void | activate () |
| Called by GameState::activate() More... | |
| virtual void | deactivate () |
| Called by GameState::deactivate() More... | |
| bool | enabled () const |
| Whether this system is enabled. More... | |
| Engine * | engine () const |
| The system's engine. More... | |
| EntityManager * | entityManager () const |
| Returns the system's entity manager. More... | |
| GameState * | gameState () const |
| Returns the system's game state. More... | |
| virtual void | init (GameState *gameState) |
| Initializes the system. More... | |
| virtual void | initNamed (std::string name, GameState *gameState) |
| Initializes the system and gives it a name. More... | |
| std::string | getName () |
| Returns system name. | |
| void | setEnabled (bool enabled) |
| Sets the enabled status of this system. More... | |
| virtual void | shutdown () |
| Shuts the system down. More... | |
| virtual void | update (int renderTime, int logicTime)=0 |
| Updates the system. More... | |
Static Public Member Functions | |
| static luabind::scope | luaBindings () |
| Lua bindings. More... | |
A system handles one specific part of the game.
Systems can operate on entities and their components, but they can also handle tasks that don't require components at all, such as issuing a render call to the graphics engine.
|
virtual |
Called by GameState::activate()
Override this if you need to restore some internal state when the system's game state is activated.
Reimplemented in thrive::SoundSourceSystem, thrive::OgreViewportSystem, thrive::TextOverlaySystem, and thrive::OgreWorkspaceSystem.
|
virtual |
Called by GameState::deactivate()
Override this if you need to clear some internal state when the system's game state is deactivated.
Reimplemented in thrive::SoundSourceSystem, thrive::OgreViewportSystem, thrive::TextOverlaySystem, and thrive::OgreWorkspaceSystem.
| bool System::enabled | ( | ) | const |
Whether this system is enabled.
Disabled systems are not being updated
| Engine * System::engine | ( | ) | const |
The system's engine.
nullptr if the system hasn't been initialized yet. | EntityManager * System::entityManager | ( | ) | const |
Returns the system's entity manager.
If the system has not been initialized yet, this returns nullptr.
| GameState * System::gameState | ( | ) | const |
Returns the system's game state.
If the system has not been initialized yet, this returns nullptr.
|
virtual |
Initializes the system.
Override this to prepare the system for updating.
| gameState | The gameState the system belongs to |
Reimplemented in thrive::RigidBodyOutputSystem, thrive::RigidBodyInputSystem, thrive::OgreUpdateSceneNodeSystem, thrive::SoundSourceSystem, thrive::OgreRemoveSceneNodeSystem, thrive::OgreAddSceneNodeSystem, thrive::CollisionSystem, thrive::CompoundEmitterSystem, thrive::BulletDebugDrawSystem, thrive::CompoundAbsorberSystem, thrive::OgreCameraSystem, thrive::OgreLightSystem, thrive::OgreViewportSystem, thrive::TextOverlaySystem, thrive::MembraneSystem, thrive::OgreWorkspaceSystem, thrive::SkySystem, thrive::CompoundCloudSystem, thrive::PowerupSystem, thrive::CompoundMovementSystem, thrive::MembraneGenerationSystem, thrive::TimedLifeSystem, thrive::BulletToOgreSystem, thrive::UpdatePhysicsSystem, and thrive::RenderSystem.
|
virtual |
Initializes the system and gives it a name.
Override init instead and then call this
| name | The name of the system (for debugging) |
| gameState | The gameState the system belongs to |
|
static |
Lua bindings.
Wrapper class to enable subclassing System in Lua.
Exposes:
| void System::setEnabled | ( | bool | enabled | ) |
Sets the enabled status of this system.
Disabled systems are not updated
| enabled |
|
virtual |
Shuts the system down.
Override this to gracefully shut down the system, releasing any resources you might have acquired in init() or during calls to update().
Reimplemented in thrive::RigidBodyOutputSystem, thrive::RigidBodyInputSystem, thrive::OgreUpdateSceneNodeSystem, thrive::SoundSourceSystem, thrive::OgreRemoveSceneNodeSystem, thrive::OgreAddSceneNodeSystem, thrive::CollisionSystem, thrive::CompoundEmitterSystem, thrive::BulletDebugDrawSystem, thrive::CompoundAbsorberSystem, thrive::OgreCameraSystem, thrive::OgreLightSystem, thrive::OgreViewportSystem, thrive::TextOverlaySystem, thrive::MembraneSystem, thrive::OgreWorkspaceSystem, thrive::SkySystem, thrive::CompoundCloudSystem, thrive::PowerupSystem, thrive::CompoundMovementSystem, thrive::MembraneGenerationSystem, thrive::TimedLifeSystem, thrive::BulletToOgreSystem, thrive::UpdatePhysicsSystem, and thrive::RenderSystem.
|
pure virtual |
Updates the system.
Override this to update the systems's state.
| renderTime | The number of milliseconds the frame took to render |
| logicTime | The number of milliseconds to advance the game logic. The same as render time except when changing gamespeed or pausing. |
Implemented in thrive::RigidBodyOutputSystem, thrive::RigidBodyInputSystem, thrive::OgreUpdateSceneNodeSystem, thrive::SoundSourceSystem, thrive::OgreRemoveSceneNodeSystem, thrive::OgreAddSceneNodeSystem, thrive::CollisionSystem, thrive::CompoundEmitterSystem, thrive::BulletDebugDrawSystem, thrive::CompoundAbsorberSystem, thrive::OgreCameraSystem, thrive::OgreLightSystem, thrive::OgreViewportSystem, thrive::TextOverlaySystem, thrive::MembraneSystem, thrive::OgreWorkspaceSystem, thrive::SkySystem, thrive::CompoundCloudSystem, thrive::PowerupSystem, thrive::CompoundMovementSystem, thrive::MembraneGenerationSystem, thrive::TimedLifeSystem, thrive::BulletToOgreSystem, thrive::RenderSystem, and thrive::UpdatePhysicsSystem.
1.8.10