Hubris Engine Dev
A Project to learn and get into Game Engine developement.
 
Loading...
Searching...
No Matches
EventBus.h
Go to the documentation of this file.
1#pragma once
2#include "ThreadPool.h"
3
4namespace Hubris::Core {
5 //This is used for Core Event Bus
6 template <typename Event>
8 public:
9 using HandlerFunc = void(*)(const Event&);
10
11 static void Subscribe(HandlerFunc func) {
12 handlers.push_back(func);
13 }
14
15 static void Dispatch(const Event& event) {
16 for (auto handler : handlers)
17 handler(event);
18 }
19
20 private:
21 static inline std::vector<HandlerFunc> handlers;
22 };
23
24 struct OnUpdate {
25
26 };
27
28 struct OnStart {
29
30 };
31}
void(*)(const Event &) HandlerFunc
Definition EventBus.h:9
static void Subscribe(HandlerFunc func)
Definition EventBus.h:11
static void Dispatch(const Event &event)
Definition EventBus.h:15