rag
graphic 2d engine
TouchEvent.h
1 #ifndef Rag_TouchEvent_h
2 #define Rag_TouchEvent_h
3 
4 #include <rag/Event.h>
5 #include <string>
6 #include <sstream>
7 
8 namespace events
9 {
10 
11  static const std::string TOUCH_BEGIN = "TouchBegin";
12  static const std::string TOUCH_END = "TouchEnd";
13  static const std::string TOUCH_MOVE = "TouchMove";
14  static const std::string TOUCH_OUT = "TouchOut";
15  static const std::string TOUCH_OVER = "TouchOver";
16  static const std::string TOUCH_TAP = "TouchTap";
17  static const std::string TOUCH_PINCH = "TouchPinch";
18 
20  class TouchEvent: public Event
21  {
22  public:
23 
24  TouchEvent(std::string type):
25  Event(type),
26  localX(0),
27  localY(0),
28  stageX(0),
29  stageY(0),
30  movementX(0),
31  movementY(0),
32  pinch(0),
33  touchId(0)
34  {};
35 
36  float localX;
37  float localY;
38  float stageX;
39  float stageY;
40  float movementX;
41  float movementY;
42  float pinch;
43  char touchId;
44 
45  virtual std::string toString()
46  {
47  std::ostringstream oss;
48  oss << "(type= " << type.c_str() << ", lx=" << localX << ", ly=" << localY << ", sx=" << stageX << ", sy=" << stageY << ")";
49  return oss.str();
50  }
51  };
52 
53 }
54 
55 #endif
virtual std::string toString()
string representing the event.
Definition: TouchEvent.h:45
Base class for event system.
Definition: Event.h:24
Event(std::string type)
Creates a new event of the given type.
Definition: Event.h:30
std::string type
The type of the event. The string should be unique for this event.
Definition: Event.h:36
Definition: Event.h:11
Event for handle input from screen.
Definition: TouchEvent.h:20