Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Ndk::BaseSystem Class Referenceabstract

NDK class that represents the common base of all systems. More...

Inherited by Ndk::System< SystemType >, Ndk::System< ListenerSystem >, Ndk::System< ParticleSystem >, Ndk::System< PhysicsSystem2D >, Ndk::System< PhysicsSystem3D >, Ndk::System< RenderSystem >, and Ndk::System< VelocitySystem >.

Public Member Functions

 BaseSystem (SystemIndex systemId)
 Constructs a BaseSystem object with an index. More...
 
 BaseSystem (const BaseSystem &)=delete
 
 BaseSystem (BaseSystem &&) noexcept=default
 
virtual ~BaseSystem ()
 Destructs the object and unregisters it-self on every entities.
 
void Enable (bool enable=true)
 Enables the system. More...
 
bool Filters (const Entity *entity) const
 Checks whether the key of the entity matches the lock of the system. More...
 
const EntityListGetEntities () const
 Gets every entities that system handle. More...
 
float GetFixedUpdateRate () const
 Gets the maximum rate of update of the system. More...
 
SystemIndex GetIndex () const
 Gets the index of the system. More...
 
float GetMaximumUpdateRate () const
 Gets the maximum rate of update of the system. More...
 
int GetUpdateOrder () const
 Gets the update order of the system. More...
 
WorldGetWorld () const
 Gets the world on which the system operate. More...
 
bool IsEnabled () const
 Checks whether or not the system is enabled. More...
 
bool HasEntity (const Entity *entity) const
 Checks whether or not the system has the entity. More...
 
void SetFixedUpdateRate (float updatePerSecond)
 Sets the fixed update rate for the system. More...
 
void SetMaximumUpdateRate (float updatePerSecond)
 Sets the maximum update rate for the system. More...
 
void SetUpdateOrder (int updateOrder)
 Sets the update order of this system. More...
 
void Update (float elapsedTime)
 Updates the system. More...
 
BaseSystemoperator= (const BaseSystem &)=delete
 
BaseSystemoperator= (BaseSystem &&) noexcept=default
 

Protected Member Functions

template<typename ComponentType >
void Excludes ()
 Excludes some component from the system.
 
template<typename ComponentType1 , typename ComponentType2 , typename... Rest>
void Excludes ()
 Excludes some components from the system.
 
void ExcludesComponent (ComponentIndex index)
 Excludes some component from the system by index. More...
 
template<typename ComponentType >
void Requires ()
 Requires some component from the system.
 
template<typename ComponentType1 , typename ComponentType2 , typename... Rest>
void Requires ()
 Requires some components from the system.
 
void RequiresComponent (ComponentIndex index)
 Requires some component for the system by index. More...
 
template<typename ComponentType >
void RequiresAny ()
 Requires any component from the system.
 
template<typename ComponentType1 , typename ComponentType2 , typename... Rest>
void RequiresAny ()
 Requires any components from the system.
 
void RequiresAnyComponent (ComponentIndex index)
 Requires any component for the system by index. More...
 
virtual void OnUpdate (float elapsedTime)=0
 

Static Protected Member Functions

static SystemIndex GetNextIndex ()
 Gets the next index for the system. More...
 

Friends

class Sdk
 

Detailed Description

NDK class that represents the common base of all systems.

Remarks
This class is meant to be purely abstract, for type erasure

Constructor & Destructor Documentation

◆ BaseSystem()

Ndk::BaseSystem::BaseSystem ( SystemIndex  systemId)
inline

Constructs a BaseSystem object with an index.

Parameters
systemIdIndex of the system

Member Function Documentation

◆ Enable()

void Ndk::BaseSystem::Enable ( bool  enable = true)
inline

Enables the system.

Parameters
enableShould the system be enabled

◆ ExcludesComponent()

void Ndk::BaseSystem::ExcludesComponent ( ComponentIndex  index)
inlineprotected

Excludes some component from the system by index.

Parameters
indexIndex of the component

◆ Filters()

bool Ndk::BaseSystem::Filters ( const Entity entity) const

Checks whether the key of the entity matches the lock of the system.

Returns
true If it is the case
Parameters
Pointerto the entity

◆ GetEntities()

const EntityList & Ndk::BaseSystem::GetEntities ( ) const
inline

Gets every entities that system handle.

Returns
A constant reference to the list of entities

◆ GetFixedUpdateRate()

float Ndk::BaseSystem::GetFixedUpdateRate ( ) const
inline

Gets the maximum rate of update of the system.

Returns
Update rate

◆ GetIndex()

SystemIndex Ndk::BaseSystem::GetIndex ( ) const
inline

Gets the index of the system.

Returns
Index of the system

◆ GetMaximumUpdateRate()

float Ndk::BaseSystem::GetMaximumUpdateRate ( ) const
inline

Gets the maximum rate of update of the system.

Returns
Update rate

◆ GetNextIndex()

SystemIndex Ndk::BaseSystem::GetNextIndex ( )
inlinestaticprotected

Gets the next index for the system.

Returns
Next unique index for the system

◆ GetUpdateOrder()

int Ndk::BaseSystem::GetUpdateOrder ( ) const
inline

Gets the update order of the system.

Returns
Update order
See also
SetUpdateOrder

◆ GetWorld()

World & Ndk::BaseSystem::GetWorld ( ) const
inline

Gets the world on which the system operate.

Returns
World in which the system is

◆ HasEntity()

bool Ndk::BaseSystem::HasEntity ( const Entity entity) const
inline

Checks whether or not the system has the entity.

Returns
true If it is the case
Parameters
entityPointer to the entity

◆ IsEnabled()

bool Ndk::BaseSystem::IsEnabled ( ) const
inline

Checks whether or not the system is enabled.

Returns
true If it is the case

◆ RequiresAnyComponent()

void Ndk::BaseSystem::RequiresAnyComponent ( ComponentIndex  index)
inlineprotected

Requires any component for the system by index.

Parameters
indexIndex of the component

◆ RequiresComponent()

void Ndk::BaseSystem::RequiresComponent ( ComponentIndex  index)
inlineprotected

Requires some component for the system by index.

Parameters
indexIndex of the component

◆ SetFixedUpdateRate()

void Ndk::BaseSystem::SetFixedUpdateRate ( float  updatePerSecond)
inline

Sets the fixed update rate for the system.

Parameters
updatePerSecondUpdate rate, 0 means update rate is not fixed

◆ SetMaximumUpdateRate()

void Ndk::BaseSystem::SetMaximumUpdateRate ( float  updatePerSecond)
inline

Sets the maximum update rate for the system.

Parameters
updatePerSecondUpdate rate, 0 means as much as possible

◆ SetUpdateOrder()

void Ndk::BaseSystem::SetUpdateOrder ( int  updateOrder)

Sets the update order of this system.

The system update order is used by the world it belongs to in order to know in which order they should be updated, as some application logic may rely a specific update order. A system with a greater update order (ex: 1) is guaranteed to be updated after a system with a lesser update order (ex: -1), otherwise the order is unspecified (and is not guaranteed to be stable).

Parameters
updateOrderThe relative update order of the system
Remarks
The update order is only used by World::Update(float) and does not have any effect regarding a call to BaseSystem::Update(float)
See also
GetUpdateOrder

◆ Update()

void Ndk::BaseSystem::Update ( float  elapsedTime)
inline

Updates the system.

Parameters
elapsedTimeDelta time used for the update

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