R-TYPE
Public Member Functions | Protected Member Functions | List of all members
ECS::EventsSystem Class Reference

#include <EventsSystem.hpp>

Inheritance diagram for ECS::EventsSystem:
ECS::System

Public Member Functions

 EventsSystem (const std::shared_ptr< ComponentManager > &componentsManager, const std::shared_ptr< EntityManager > &entityManager)
 
 ~EventsSystem ()=default
 
void update ()
 
void setSfml (std::shared_ptr< InitSfml > sfml)
 
void setClock (std::shared_ptr< Clock > clock)
 
bool checkIsValidEntity (Entity entity)
 
void setEvents (std::size_t entity, std::deque< Button > event)
 
void clearEvents ()
 
- Public Member Functions inherited from ECS::System
 System (const std::shared_ptr< ComponentManager > &componentManager, const std::shared_ptr< EntityManager > &entityManager)
 
 ~System ()=default
 

Protected Member Functions

void modifyAcceleration (Entity entity, std::deque< Button > &event)
 
void shoot (Entity entity)
 

Additional Inherited Members

- Protected Attributes inherited from ECS::System
std::shared_ptr< ComponentManager_componentManager
 
std::shared_ptr< EntityManager_entityManager
 

Constructor & Destructor Documentation

◆ EventsSystem()

ECS::EventsSystem::EventsSystem ( const std::shared_ptr< ComponentManager > &  componentsManager,
const std::shared_ptr< EntityManager > &  entityManager 
)

It's a constructor for the EventsSystem class

Parameters
componentsManagerThe ComponentManager that will be used to get the components of the entities.
entityManagerThe entity manager that will be used to create entities.

◆ ~EventsSystem()

ECS::EventsSystem::~EventsSystem ( )
default

Member Function Documentation

◆ checkIsValidEntity()

bool ECS::EventsSystem::checkIsValidEntity ( Entity  entity)
virtual

If the entity has a speed, health, sprite, and position component, then it's valid

Parameters
entityThe entity to check
Returns
A boolean value.

Implements ECS::System.

◆ clearEvents()

void ECS::EventsSystem::clearEvents ( )

It clears all the events in the current events map.

◆ modifyAcceleration()

void ECS::EventsSystem::modifyAcceleration ( Entity  entity,
std::deque< Button > &  event 
)
protected

It modifies the acceleration of an entity based on the event that was triggered

Parameters
entityThe entity that will be modified.
eventThe event that was triggered.

◆ setClock()

void ECS::EventsSystem::setClock ( std::shared_ptr< Clock clock)

◆ setEvents()

void ECS::EventsSystem::setEvents ( std::size_t  entity,
std::deque< Button event 
)

◆ setSfml()

void ECS::EventsSystem::setSfml ( std::shared_ptr< InitSfml sfml)

It sets the sfml pointer to the one passed in

Parameters
sfmlThe InitSfml class that is used to initialize the SFML library.

◆ shoot()

void ECS::EventsSystem::shoot ( Entity  entity)
protected

It creates a new entity, adds a position, health, sprite, and speed component to it, and then sets the sprite's position to the player's position

Parameters
entitythe entity that is shooting

◆ update()

void ECS::EventsSystem::update ( )
virtual

It checks if the entity is a player, if it's valid, and if it is, it checks if the player has pressed the space key, and if so, it shoots a bullet. If the player has pressed any other key, it modifies the acceleration of the player

Implements ECS::System.


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