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
4
namespace
Hubris::Core
{
5
//This is used for Core Event Bus
6
template
<
typename
Event>
7
class
StaticEventBus
{
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
}
ThreadPool.h
Hubris::Core::StaticEventBus
Definition
EventBus.h:7
Hubris::Core::StaticEventBus::HandlerFunc
void(*)(const Event &) HandlerFunc
Definition
EventBus.h:9
Hubris::Core::StaticEventBus::Subscribe
static void Subscribe(HandlerFunc func)
Definition
EventBus.h:11
Hubris::Core::StaticEventBus::Dispatch
static void Dispatch(const Event &event)
Definition
EventBus.h:15
Hubris::Core
Definition
EventBus.h:4
Hubris::Core::OnStart
Definition
EventBus.h:28
Hubris::Core::OnUpdate
Definition
EventBus.h:24
include
Core
EventBus.h
Generated by
1.13.2