49 lines
868 B
C++
49 lines
868 B
C++
/*
|
|
* InputEventHandler.h
|
|
*
|
|
* Created on: Apr 5, 2018
|
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
|
*/
|
|
|
|
#ifndef INPUTEVENTHANDLER_H_
|
|
#define INPUTEVENTHANDLER_H_
|
|
|
|
#include "InputEvent.h"
|
|
|
|
namespace Input
|
|
{
|
|
|
|
class InputEventHandler
|
|
{
|
|
|
|
|
|
class Detector
|
|
{
|
|
public:
|
|
void register_input_event_handler(InputEventHandler* handler);
|
|
void unregister_input_event_handler(InputEventHandler* handler);
|
|
|
|
};
|
|
public:
|
|
InputEventHandler(std::shared_ptr<Detector> detector) :
|
|
detector(detector)
|
|
{
|
|
this->detector->register_input_event_handler(this);
|
|
}
|
|
|
|
virtual ~InputEventHandler()
|
|
{
|
|
this->detector->unregister_input_event_handler(this);
|
|
this->detector = NULL;
|
|
}
|
|
|
|
virtual void handle(InputEvent& event) = 0;
|
|
|
|
private:
|
|
std::shared_ptr<Detector> detector;
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* INPUTEVENTHANDLER_H_ */
|