O'Reilly logo

SFML Game Development By Example by Raimondas Pupius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the event manager

At this time, we have everything we need to actually write the header of our event manager class. Given all the design decisions we made previously, it should come out looking something like the following:

class EventManager{ public: EventManager(); ~EventManager(); bool AddBinding(Binding *l_binding); bool RemoveBinding(std::string l_name); void SetFocus(const bool& l_focus); // Needs to be defined in the header! template<class T> bool AddCallback(const std::string& l_name, void(T::*l_func)(EventDetails*), T* l_instance) { auto temp = std::bind(l_func,l_instance, std::placeholders::_1); return m_callbacks.emplace(l_name, temp).second; } void RemoveCallback(const std::string& l_name){ m_callbacks.erase(l_name); } void ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required