All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TouchEventWrapper.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include <vector>
6 
7 namespace Eegeo
8 {
9  namespace Android
10  {
11  namespace Input
12  {
14  {
15  float x, y;
16  int pointerIdentity;
17  int pointerIndex;
18 
19  TouchInputPointerEvent(float x, float y, int pointerIdentity, int pointerIndex)
20  :x(x), y(y), pointerIdentity(pointerIdentity), pointerIndex(pointerIndex)
21  {
22 
23  }
24  };
25 
26  namespace TouchEvent
27  {
28  enum Type
29  {
30  PointerUp,
31  PointerDown,
32  PointerMove
33  };
34  }
35 
37  {
38  bool isPointerUpEvent;
39  bool isPointerDownEvent;
40  int primaryActionIndex;
41  int primaryActionIdentifier;
42  std::vector<TouchInputPointerEvent> pointerEvents;
43 
45  bool isPointerUpEvent,
46  bool isPointerDownEvent,
47  int primaryActionIndex,
48  int primaryActionIdentifier)
49  :isPointerUpEvent(isPointerUpEvent)
50  ,isPointerDownEvent(isPointerDownEvent)
51  ,primaryActionIndex(primaryActionIndex)
52  ,primaryActionIdentifier(primaryActionIdentifier)
53  {
54 
55  }
56 
58  TouchEvent::Type touchEventType,
59  int primaryActionIndex,
60  int primaryActionIdentifier,
61  const std::vector<TouchInputPointerEvent>& pointerEvents)
62  : primaryActionIndex(primaryActionIndex)
63  , primaryActionIdentifier(primaryActionIdentifier)
64  , pointerEvents(pointerEvents)
65  {
66  switch (touchEventType)
67  {
68  case Eegeo::Android::Input::TouchEvent::Type::PointerUp:
69  isPointerUpEvent = true;
70  isPointerDownEvent = false;
71  break;
72  case Eegeo::Android::Input::TouchEvent::Type::PointerDown:
73  isPointerUpEvent = false;
74  isPointerDownEvent = true;
75  break;
76  case Eegeo::Android::Input::TouchEvent::Type::PointerMove:
77  isPointerUpEvent = false;
78  isPointerDownEvent = false;
79  break;
80  }
81  }
82  };
83  }
84  }
85 }