#include <EventsSystem.hpp>
◆ 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
-
componentsManager | The ComponentManager that will be used to get the components of the entities. |
entityManager | The entity manager that will be used to create entities. |
◆ ~EventsSystem()
ECS::EventsSystem::~EventsSystem |
( |
| ) |
|
|
default |
◆ checkIsValidEntity()
bool ECS::EventsSystem::checkIsValidEntity |
( |
Entity |
entity | ) |
|
|
virtual |
If the entity has a speed, health, sprite, and position component, then it's valid
- Parameters
-
entity | The 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
-
entity | The entity that will be modified. |
event | The 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
-
sfml | The 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
-
entity | the 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: