RedCore
Loading...
Searching...
No Matches
EventBase.h
Go to the documentation of this file.
1#pragma once
2
3#include <red/event_sys/EventDelegator.h>
4
5namespace red {
6
7 template <typename T>
8 class EventBase {
9 public:
11 using ListenerFunc = void (*)(T&);
12
13 public:
14 void consume() { mConsumed = true; }
15
16 [[nodiscard]]
17 bool isConsumed() const { return mConsumed; }
18
19 protected:
21 public:
22 BasicListener(ListenerFunc f, s32 priority = 0)
24 {
25 T::subscribe(mListener);
26 }
27
28 private:
29 EventDelegator<T>::Listener mListener;
30 };
31
32 private:
33 bool mConsumed = false;
34 };
35
36}
Definition EventBase.h:20
BasicListener(ListenerFunc f, s32 priority=0)
Definition EventBase.h:22
Definition EventBase.h:8
void consume()
Definition EventBase.h:14
void(*)(T &) ListenerFunc
Definition EventBase.h:11
bool isConsumed() const
Definition EventBase.h:17
Definition ActorDonutBlock.h:5