diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-18 15:40:11 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-18 15:40:11 +0100 |
commit | 71a614e1f87141c4d062a2a466377322fc3d9ff0 (patch) | |
tree | 018f9007cfbe04d95716c5bde3ce3d5c73659fe1 /src/crepe/api/EventManager.hpp | |
parent | b92da3c729c8fc7c002cb3acbb75c56cb63bd89e (diff) |
make format
Diffstat (limited to 'src/crepe/api/EventManager.hpp')
-rw-r--r-- | src/crepe/api/EventManager.hpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/crepe/api/EventManager.hpp b/src/crepe/api/EventManager.hpp index d901492..b20b88f 100644 --- a/src/crepe/api/EventManager.hpp +++ b/src/crepe/api/EventManager.hpp @@ -4,8 +4,8 @@ namespace crepe { template <typename EventType> void EventManager::subscribe(EventHandler<EventType> && callback, int channel) { - using HandlersMap = std::unordered_map< - int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; + using HandlersMap + = std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; using HandlersVec = std::vector<std::unique_ptr<IEventHandlerWrapper>>; std::type_index event_type = typeid(EventType); @@ -30,18 +30,17 @@ template <typename EventType> void EventManager::queue_event(EventType && event, int channel) { std::type_index event_type = std::type_index(typeid(EventType)); - auto event_ptr - = std::make_unique<EventType>(std::forward<EventType>(event)); + auto event_ptr = std::make_unique<EventType>(std::forward<EventType>(event)); - std::tuple<std::unique_ptr<Event>, int, std::type_index> tuple( - std::move(event_ptr), channel, event_type); + std::tuple<std::unique_ptr<Event>, int, std::type_index> tuple(std::move(event_ptr), + channel, event_type); this->events_queue.push_back(std::move(tuple)); } template <typename EventType> void EventManager::trigger_event(const EventType & event, int channel) { - using HandlersMap = std::unordered_map< - int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; + using HandlersMap + = std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; using HandlersVec = std::vector<std::unique_ptr<IEventHandlerWrapper>>; std::type_index event_type = std::type_index(typeid(EventType)); @@ -71,10 +70,9 @@ void EventManager::trigger_event(const EventType & event, int channel) { } template <typename EventType> -void EventManager::unsubscribe(const EventHandler<EventType> & callback, - int channel) { - using HandlersMap = std::unordered_map< - int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; +void EventManager::unsubscribe(const EventHandler<EventType> & callback, int channel) { + using HandlersMap + = std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; using HandlersVec = std::vector<std::unique_ptr<IEventHandlerWrapper>>; std::type_index event_type(typeid(EventType)); |