TailorMade 2.0
Tailor Made is a high-performance C++20 ECS library with on-the-fly entity creation and JSON-based definitions for entities, components, and their relationships.
 
Loading...
Searching...
No Matches
System Class Referenceabstract

#include <System.h>

Public Member Functions

 System (std::shared_ptr< Environment > environment, bool autoUpdate=true)
 The constructor of the System, which take the Environment as a parameter.
 
void newEntity (int entity)
 UPDATE THAT.
 
void changeEnvironment (std::shared_ptr< Environment > environment)
 Let you change the Environment.
 
const size_t & getID ()
 Return the System's ID.
 
bool getChange ()
 Return the value of change and, if change is true flipped it back to false.
 
virtual void run ()=0
 This is an abstract method which will contains the logic of the System and can be call by the user to process on this System's entities and components.
 

Protected Member Functions

void addComponent (const std::string &name)
 Let you add, inside a System, which component should be gathered from the Environment.
 
void addComponents (std::vector< std::string > names)
 Version with a list of desired components.
 
void addRejected (const std::string &name)
 Let you add a components to the rejected components, if the entity possess at list one of this components it will not be added.
 
void addRejects (std::vector< std::string > names)
 Version with a list of rejected components.
 
void addTag (const std::string &tagName)
 Let you add, inside a System, which tag should be gathered from the Environment.
 
void addTags (std::vector< std::string > names)
 Version with a list of tags.
 

Protected Attributes

std::unordered_set< int > entities
 The entities of this system.
 
std::shared_ptr< Environmentenvironment
 A shared_ptr towards the Environment.
 
std::vector< std::string > desiredComponents
 Represent the components this System want.
 
std::vector< std::string > rejectedComponents
 Represent the components this System absolutely doesn't want.
 
std::vector< std::string > desiredTags
 Represent the tags this System want.
 
std::mutex mtx
 Mutex for the entities' vector.
 

Constructor & Destructor Documentation

◆ System()

System::System ( std::shared_ptr< Environment > environment,
bool autoUpdate = true )

The constructor of the System, which take the Environment as a parameter.

Parameters
environment

Member Function Documentation

◆ addComponent()

void System::addComponent ( const std::string & name)
protected

Let you add, inside a System, which component should be gathered from the Environment.

Parameters
name

◆ addComponents()

void System::addComponents ( std::vector< std::string > names)
protected

Version with a list of desired components.

Parameters
name

◆ addRejected()

void System::addRejected ( const std::string & name)
protected

Let you add a components to the rejected components, if the entity possess at list one of this components it will not be added.

Parameters
name

◆ addRejects()

void System::addRejects ( std::vector< std::string > names)
protected

Version with a list of rejected components.

Parameters
name

◆ addTag()

void System::addTag ( const std::string & tagName)
protected

Let you add, inside a System, which tag should be gathered from the Environment.

Parameters
name

◆ addTags()

void System::addTags ( std::vector< std::string > names)
protected

Version with a list of tags.

Parameters
name

◆ changeEnvironment()

void System::changeEnvironment ( std::shared_ptr< Environment > environment)

Let you change the Environment.

Parameters
environment

◆ getChange()

bool System::getChange ( )

Return the value of change and, if change is true flipped it back to false.

◆ getID()

const size_t & System::getID ( )

Return the System's ID.

◆ newEntity()

void System::newEntity ( int entity)

UPDATE THAT.

Parameters
entities

◆ run()

virtual void System::run ( )
pure virtual

This is an abstract method which will contains the logic of the System and can be call by the user to process on this System's entities and components.

Member Data Documentation

◆ desiredComponents

std::vector<std::string> System::desiredComponents
protected

Represent the components this System want.

◆ desiredTags

std::vector<std::string> System::desiredTags
protected

Represent the tags this System want.

◆ entities

std::unordered_set<int> System::entities
protected

The entities of this system.

◆ environment

std::shared_ptr<Environment> System::environment
protected

A shared_ptr towards the Environment.

◆ mtx

std::mutex System::mtx
protected

Mutex for the entities' vector.

◆ rejectedComponents

std::vector<std::string> System::rejectedComponents
protected

Represent the components this System absolutely doesn't want.


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