R-TYPE
EventsSystem.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2022
3 ** r-type
4 ** File description:
5 ** EventsSystem
6 */
7 
8 #ifndef EVENTSSYSTEM_HPP_
9 #define EVENTSSYSTEM_HPP_
10 
11 #include "./System.hpp"
12 
13 namespace ECS {
14 class EventsSystem : public System {
15 public:
16  EventsSystem(const std::shared_ptr<ComponentManager>& componentsManager, const std::shared_ptr<EntityManager>& entityManager);
17  ~EventsSystem() = default;
18 
19  void update();
20  void setSfml(std::shared_ptr<InitSfml> sfml);
21  void setClock(std::shared_ptr<Clock> clock);
22  bool checkIsValidEntity(Entity entity);
23  void setEvents(std::size_t entity, std::deque<Button> event);
24  void clearEvents();
25 
26 protected:
27  void modifyAcceleration(Entity entity, std::deque<Button> &event);
28  void shoot(Entity entity);
29 
30 private:
31  std::unordered_map<std::size_t, std::deque<Button>> _currentEvents;
32  std::shared_ptr<InitSfml> _sfml;
33  std::shared_ptr<Clock> _clock;
34 };
35 } // namespace ECS
36 
37 #endif /* !EVENTSSYSTEM_HPP_ */
Definition: Entity.hpp:30
Definition: EventsSystem.hpp:14
void setClock(std::shared_ptr< Clock > clock)
Definition: EventsSystem.cpp:58
void setSfml(std::shared_ptr< InitSfml > sfml)
Definition: EventsSystem.cpp:53
EventsSystem(const std::shared_ptr< ComponentManager > &componentsManager, const std::shared_ptr< EntityManager > &entityManager)
Definition: EventsSystem.cpp:17
void shoot(Entity entity)
Definition: EventsSystem.cpp:112
~EventsSystem()=default
bool checkIsValidEntity(Entity entity)
Definition: EventsSystem.cpp:149
void modifyAcceleration(Entity entity, std::deque< Button > &event)
Definition: EventsSystem.cpp:76
void setEvents(std::size_t entity, std::deque< Button > event)
Definition: EventsSystem.cpp:64
void update()
Definition: EventsSystem.cpp:27
void clearEvents()
Definition: EventsSystem.cpp:134
Definition: System.hpp:18
Definition: ComponentManager.hpp:14