#include "iKeyListener.h" IKeyListener::~IKeyListener() { unsubscribeEvents(); } void IKeyListener::subscribeEvents(int listenerId) { keyPressedHandler = [this](const KeyPressedEvent & event) { this->onKeyPressed(event); }; keyReleasedHandler = [this](const KeyReleasedEvent & event) { this->onKeyReleased(event); }; subscribe(keyPressedHandler, listenerId); subscribe(keyReleasedHandler, listenerId); } void IKeyListener::unsubscribeEvents(int listenerId) { unsubscribe(keyPressedHandler, listenerId); unsubscribe(keyReleasedHandler, listenerId); }