R-TYPE
Public Member Functions | List of all members
Clock Class Reference

#include <Clock.hpp>

Public Member Functions

 Clock ()=default
 
 ~Clock ()=default
 
void addClockComponent (size_t entityId, ECS::ComponentType type, int updateTime)
 
std::deque< std::pair< size_t, std::deque< ECS::ComponentType > > > getEntitiesToUpdate ()
 
int componentUpdateNumber (size_t entity, ECS::ComponentType type)
 
void eraseClockComponent (size_t entityId, ECS::ComponentType, bool debug=false)
 
void eraseClock (size_t entityId)
 

Constructor & Destructor Documentation

◆ Clock()

Clock::Clock ( )
default

◆ ~Clock()

Clock::~Clock ( )
default

Member Function Documentation

◆ addClockComponent()

void Clock::addClockComponent ( size_t  entity,
ECS::ComponentType  type,
int  updateTime 
)

It adds a component to the clock

Parameters
entityThe entity to which the component is attached.
typeThe type of the component you want to add to the clock.
updateTimeThe time in milliseconds between each update.

◆ componentUpdateNumber()

int Clock::componentUpdateNumber ( size_t  entity,
ECS::ComponentType  type 
)

"If the time since the last update is greater than the timer, then update the entity and return the number of times the entity was updated."

The function is a bit more complicated than that, but that's the gist of it

Parameters
entityThe entity to check for updates.
typeThe type of the component you want to update.
Returns
The number of times the component has been updated.

◆ eraseClock()

void Clock::eraseClock ( size_t  entity)

It erases the clock of the entity passed in parameter

Parameters
entityThe entity you want to erase the clock of.

◆ eraseClockComponent()

void Clock::eraseClockComponent ( size_t  entity,
ECS::ComponentType  type,
bool  debug = false 
)

It removes a component from the clock

Parameters
entityThe entity ID from where the component will be removed.
typeThe type of the component to be removed.
debugif true, the function will print some information about the removal of the component.
Returns
A reference to the component of the entity.

◆ getEntitiesToUpdate()

std::deque< std::pair< size_t, std::deque< ECS::ComponentType > > > Clock::getEntitiesToUpdate ( )

It returns a deque of pairs of entity IDs and component types that need to be updated

Returns
A deque of pairs of size_t and deque of ComponentType.

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