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