00001 #ifndef __KX_EVENTMANAGER
00002 #define __KX_EVENTMANAGER
00003
00004 #include <vector>
00005 #include <algorithm>
00006
00007 class SCA_EventManager
00008 {
00009 protected:
00010 std::vector <class SCA_ISensor*> m_sensors;
00011
00012 public:
00013 enum EVENT_MANAGER_TYPE {
00014 KEYBOARD_EVENTMGR = 0,
00015 MOUSE_EVENTMGR,
00016 ALWAYS_EVENTMGR,
00017 TOUCH_EVENTMGR,
00018 PROPERTY_EVENTMGR,
00019 TIME_EVENTMGR,
00020 RANDOM_EVENTMGR,
00021 RAY_EVENTMGR,
00022 RADAR_EVENTMGR,
00023 NETWORK_EVENTMGR
00024 };
00025 SCA_EventManager() {}
00026 virtual ~SCA_EventManager() {};
00027 SCA_EventManager(EVENT_MANAGER_TYPE mgrtype) :m_mgrtype(mgrtype){};
00028
00029 virtual void RemoveSensor(class SCA_ISensor* sensor)
00030 {
00031 std::vector<SCA_ISensor*>::iterator i =
00032 std::find(m_sensors.begin(), m_sensors.end(), sensor);
00033 if (!(i == m_sensors.end()))
00034 {
00035 std::swap(*i, m_sensors.back());
00036 m_sensors.pop_back();
00037 }
00038 }
00039 virtual void NextFrame(double curtime,double deltatime)=0;
00040 virtual void EndFrame() {};
00041 virtual void RegisterSensor(class SCA_ISensor* sensor)=0;
00042 int GetType() { return (int) m_mgrtype;}
00043 protected:
00044 EVENT_MANAGER_TYPE m_mgrtype;
00045 };
00046 #endif