AppEvent.h 999 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // AppEvent.h
  3. // Simulator
  4. //
  5. //
  6. #ifndef __Simulator__AppEvent__
  7. #define __Simulator__AppEvent__
  8. #include <string>
  9. #include "cocos2d.h"
  10. // encode / decode json
  11. #include "json/document-wrapper.h"
  12. #include "json/filereadstream.h"
  13. #include "json/stringbuffer.h"
  14. #include "json/writer.h"
  15. #include "SimulatorExport.h"
  16. enum
  17. {
  18. APP_EVENT_MENU = 1,
  19. APP_EVENT_DROP = 2
  20. };
  21. #define kAppEventDropName "APP.EVENT.DROP"
  22. #define kAppEventName "APP.EVENT"
  23. class CC_LIBSIM_DLL AppEvent : public cocos2d::EventCustom
  24. {
  25. public:
  26. /** Constructor */
  27. AppEvent(const std::string& eventName, int type);
  28. /** Gets event name */
  29. inline const std::string& getEventName() const { return _eventName; };
  30. void setEventType(int type);
  31. int getEventType();
  32. void setDataString(std::string data);
  33. std::string getDataString();
  34. protected:
  35. std::string _eventName;
  36. std::string _dataString;
  37. int _eventType;
  38. };
  39. #endif /* defined(__Simulator__AppEvent__) */