System

Inherited: ObjectSystem

Description

Systems are a basic processors for each Component in the game.

Note: All methods will be called internaly in the engine.

Note: Systems can process only components which registered in this system.

Note: Systems can be executed one by one or in parallel based on thread policy.

Public Methods

void

composeComponent (Component * component) const

bool

init ()

void

processEvents ()

void

setActiveWorld (World * world)

void

syncSettings () const

int

threadPolicy () const

void

update (World * world)

Public Enums

enum System::ThreadPolicy

Constant

Value

Description

System::Main

0

The System::update will be executed one by one in the main thread. This method is handy when you need to execute systems with exact sequence. This policy uses only one CPU core.

System::Pool

1

The System::update will be executed in the dedicated thread pool. Please note, there is no warranty of a sequence of execution for this case. This policy is preferable because it utilizes CPU cores more efficiently.

Static Methods

None

Methods Description

void System::composeComponent (Component * component) const

This method is a helper to initialize specifically a new component. Usually used in the editor.


bool System::init ()

Can be used to initialize and execute necessary routines. This method will be called automatically just after the engine started. Returns true if success.


void System::processEvents ()

Reimplements: ObjectSystem::processEvents().

Processes all incoming events and executes the System::update method.


void System::setActiveWorld (World * world)

Sets active world.


void System::syncSettings () const

This method is a callback to react on saving game settings.


int System::threadPolicy () const

Returns the thread policy of the system. For more details please refer to System::ThreadPolicy enum.


void System::update (World * world)

All processing operations for the current world must be done in this method.