refactoring
This commit is contained in:
@@ -13,12 +13,34 @@
|
||||
namespace Input
|
||||
{
|
||||
|
||||
|
||||
class InputEventHandler
|
||||
{
|
||||
|
||||
|
||||
class Detector
|
||||
{
|
||||
public:
|
||||
virtual ~InputEventHandler(){};
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user