My Project
EventHandler.h
1 #pragma once
2 #include "EventClasses.h"
3 
4 namespace ParaEngine
5 {
6  struct Event;
7 
11  class CEventHandler : public boost::signals2::trackable
12  {
13  public:
19  virtual int OnEvent(const IEvent* event, const string& sScriptCode);
20 
21  private:
23  string m_sID;
25  string m_sFileName;
27  string m_sCode;
29  DWORD m_type;
30  public:
31  const string& GetCode() const {return m_sCode;};
32  const string& GetFileName() const {return m_sFileName;};
33  void SetScript(const string& sScript);
34  bool Equals(const CEventHandler& e) const {return (m_sID==e.m_sID);}
35  bool Equals(const string& sID) const {return (m_sID==sID);}
36  inline bool IsMouseEvent() const {return (m_type & (EH_MOUSE|EH_MOUSE_MOVE|EH_MOUSE_DOWN|EH_MOUSE_UP))>0;}
37  inline bool IsKeyEvent()const {return (m_type & (EH_KEY | EH_KEY_UP))>0;}
38  inline bool IsEditorEvent()const {return (m_type & EH_EDITOR)>0;}
39  inline bool IsSystemEvent()const {return (m_type & EH_SYSTEM)>0;}
40  inline bool IsNetworkEvent()const {return (m_type & EH_NETWORK)>0;}
41  inline bool IsTouchEvent()const { return (m_type & EH_TOUCH)>0; }
42  inline bool IsEvent(int nEventType)const {return (m_type & (0x1<<nEventType))>0;}
44  DWORD GetType(){return m_type;};
45  public:
46 
47  CEventHandler(DWORD nType, const string& sID, const string& sScript);
48 
61  CEventHandler(const string& sID, const string& sScript);
62  ~CEventHandler(void){};
63  };
64 }
virtual int OnEvent(const IEvent *event, const string &sScriptCode)
the callback function, when a given event is fired.
Definition: EventHandler.cpp:73
different physics engine has different winding order.
Definition: EventBinding.h:32
DWORD GetType()
get the event type.
Definition: EventHandler.h:44
event handler
Definition: EventHandler.h:11
the event interface
Definition: IEvent.h:8