diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-07-30 11:02:39 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-07-30 11:02:39 -0400 |
commit | b1f93a4f8a5a3e84db9f00d0b41749d4fb32ed26 (patch) | |
tree | 83016b80294f6b7681093ae46aa55840b6fb9ec1 /entityx/Event.h | |
parent | 69768fdc5050bbe5877bf80108584400ea292a4f (diff) |
event feature work; ozone bgm redone
Diffstat (limited to 'entityx/Event.h')
-rw-r--r-- | entityx/Event.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/entityx/Event.h b/entityx/Event.h index cb7b3ab..988c9a1 100644 --- a/entityx/Event.h +++ b/entityx/Event.h @@ -37,7 +37,7 @@ class BaseEvent { }; -typedef Simple::Signal<void (const void*)> EventSignal; +typedef Simple::Signal<bool (const void*)> EventSignal; typedef std::shared_ptr<EventSignal> EventSignalPtr; typedef std::weak_ptr<EventSignal> EventSignalWeakPtr; @@ -123,7 +123,7 @@ class EventManager : entityx::help::NonCopyable { */ template <typename E, typename Receiver> void subscribe(Receiver &receiver) { - void (Receiver::*receive)(const E &) = &Receiver::receive; + bool (Receiver::*receive)(const E &) = &Receiver::receive; auto sig = signal_for(Event<E>::family()); auto wrapper = EventCallbackWrapper<E>(std::bind(receive, &receiver, std::placeholders::_1)); auto connection = sig->connect(wrapper); @@ -205,9 +205,9 @@ class EventManager : entityx::help::NonCopyable { // Functor used as an event signal callback that casts to E. template <typename E> struct EventCallbackWrapper { - explicit EventCallbackWrapper(std::function<void(const E &)> callback) : callback(callback) {} - void operator()(const void *event) { callback(*(static_cast<const E*>(event))); } - std::function<void(const E &)> callback; + explicit EventCallbackWrapper(std::function<bool(const E &)> callback) : callback(callback) {} + bool operator()(const void *event) { return callback(*(static_cast<const E*>(event))); } + std::function<bool(const E &)> callback; }; std::vector<EventSignalPtr> handlers_; |