2010-04-21 14:48:36 +00:00
|
|
|
#ifndef EVENTHANDLER_H
|
|
|
|
#define EVENTHANDLER_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <map>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "Debug.h"
|
2019-04-11 04:31:04 -04:00
|
|
|
#include <irrlicht/irrlicht.h>
|
2010-04-21 14:48:36 +00:00
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
|
|
|
using std::make_pair;
|
2019-04-11 04:31:04 -04:00
|
|
|
using std::map;
|
2010-04-21 14:48:36 +00:00
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
enum EventReceiverType {
|
2010-04-21 14:48:36 +00:00
|
|
|
ERT_USERINTERFACE = 1,
|
|
|
|
ERT_3DVIEW = 2
|
|
|
|
};
|
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
enum UserEventIdentifier {
|
2010-04-23 07:28:59 +00:00
|
|
|
UEI_WINDOWSIZECHANGED = 1
|
|
|
|
};
|
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
class EventHandler : public irr::IEventReceiver {
|
2010-04-21 14:48:36 +00:00
|
|
|
private:
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::IrrlichtDevice* m_Device;
|
|
|
|
map<EventReceiverType, IEventReceiver*>* m_EventReceivers;
|
|
|
|
|
2010-04-21 14:48:36 +00:00
|
|
|
public:
|
2019-04-11 04:31:04 -04:00
|
|
|
EventHandler(irr::IrrlichtDevice* device);
|
2010-04-21 14:48:36 +00:00
|
|
|
~EventHandler();
|
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
bool addEventReceiver(EventReceiverType type, irr::IEventReceiver* receiver);
|
2010-04-21 14:48:36 +00:00
|
|
|
|
|
|
|
// IEventReceiver
|
2019-04-11 04:31:04 -04:00
|
|
|
virtual bool OnEvent(const irr::SEvent& event);
|
2010-04-21 14:48:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EVENTHANDLER_H
|