74 template<
typename ENUM_TYPE>
87 template<
typename ENUM_TYPE>
108 template<
typename ENUM_TYPE>
111 SystemCallback resolve =
nullptr,
112 SystemCallback reject =
nullptr);
116 class SubscribableDispatcher :
public EventDispatcher
119 void fire(
const std::optional<sf::Event>& event)
override {};
120 bool occurred(
const std::optional<sf::Event>& event)
override {};
125#include "../../../src/Traits/Subscribable.tpp"
#define ML_EXPORT(ClassName)
Register a Malena type with the framework.
Base class for all event-receiving traits.
Trait that allows a component to subscribe to and publish framework events.
void subscribe(ENUM_TYPE event, Callback callback)
Subscribe to an enum-keyed event with a no-argument callback.
void subscribe(ENUM_TYPE event, EventCallback callback)
Subscribe to an enum-keyed event with a full SFML event callback.
void publish(ENUM_TYPE event, FilterCallback filter=[](EventReceiver &){ return true;}, SystemCallback resolve=nullptr, SystemCallback reject=nullptr)
Fire an enum-keyed event to all matching subscribers.
std::function< void(const std::optional< sf::Event > &)> EventCallback
Callback type for event handlers that receive the raw SFML event.
std::function< void()> Callback
Callback type for no-argument event handlers.