Thrive
Classes | Public Member Functions | Static Public Member Functions | List of all members
thrive::System Class Referenceabstract

A system handles one specific part of the game. More...

#include <system.h>

Inheritance diagram for thrive::System:
thrive::BulletDebugDrawSystem thrive::BulletToOgreSystem thrive::CollisionSystem thrive::CompoundAbsorberSystem thrive::CompoundCloudSystem thrive::CompoundEmitterSystem thrive::CompoundMovementSystem thrive::MembraneGenerationSystem thrive::MembraneSystem thrive::OgreAddSceneNodeSystem thrive::OgreCameraSystem thrive::OgreLightSystem thrive::OgreRemoveSceneNodeSystem thrive::OgreUpdateSceneNodeSystem thrive::OgreViewportSystem thrive::OgreWorkspaceSystem thrive::PowerupSystem thrive::RenderSystem thrive::RigidBodyInputSystem thrive::RigidBodyOutputSystem thrive::SkySystem thrive::SoundSourceSystem thrive::TextOverlaySystem thrive::TimedLifeSystem thrive::UpdatePhysicsSystem

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...
 

Detailed Description

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.

Member Function Documentation

void System::activate ( )
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.

void System::deactivate ( )
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

Returns
Engine * System::engine ( ) const

The system's engine.

Returns
The system's engine or 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.

void System::init ( GameState *  gameState)
virtual
void System::initNamed ( std::string  name,
GameState *  gameState 
)
virtual

Initializes the system and gives it a name.

Override init instead and then call this

Parameters
nameThe name of the system (for debugging)
gameStateThe gameState the system belongs to
luabind::scope System::luaBindings ( )
static

Lua bindings.

Wrapper class to enable subclassing System in Lua.

Exposes:

  • System::active
  • System::setActive
Returns
void System::setEnabled ( bool  enabled)

Sets the enabled status of this system.

Disabled systems are not updated

Parameters
enabled
void System::shutdown ( )
virtual
virtual void thrive::System::update ( int  renderTime,
int  logicTime 
)
pure virtual

Updates the system.

Override this to update the systems's state.

  • *
    Parameters
    renderTimeThe number of milliseconds the frame took to render
    logicTimeThe number of milliseconds to advance the game logic. The same as render time except when changing gamespeed or pausing.
    Note
    If you need to know the time since the last call to this system's update() function, you'll have to measure it yourself.

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.


The documentation for this class was generated from the following files: