aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/EventHandler.hpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-21 09:30:51 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-21 09:30:51 +0100
commite2f085c444a8b37af65816e10bf366e6860d25c2 (patch)
treecec8c3e5640f659478838534ad64b86502bc8e29 /src/crepe/api/EventHandler.hpp
parent9d66b6cfccd15a1600c30af5e744e8b0710eeae6 (diff)
parent1cc120a0031cfc19c35240da8390d9129b4d75a3 (diff)
merge `master` into `loek/util`
Diffstat (limited to 'src/crepe/api/EventHandler.hpp')
-rw-r--r--src/crepe/api/EventHandler.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/crepe/api/EventHandler.hpp b/src/crepe/api/EventHandler.hpp
new file mode 100644
index 0000000..391dcca
--- /dev/null
+++ b/src/crepe/api/EventHandler.hpp
@@ -0,0 +1,18 @@
+#include <typeindex>
+
+#include "EventHandler.h"
+
+namespace crepe {
+
+// Implementation of EventHandlerWrapper constructor
+template <typename EventType>
+EventHandlerWrapper<EventType>::EventHandlerWrapper(const EventHandler<EventType> & handler)
+ : handler(handler) {}
+
+// Implementation of EventHandlerWrapper::call
+template <typename EventType>
+bool EventHandlerWrapper<EventType>::call(const Event & e) {
+ return this->handler(static_cast<const EventType &>(e));
+}
+
+} //namespace crepe