MCPcopy Create free account
hub / github.com/Bzi-Han/AndroidSurfaceImgui / ATouchEvent

Class ATouchEvent

includes/ATouchEvent.h:59–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 }
58
59 class ATouchEvent
60 {
61 public:
62 enum class EventType : uint32_t
63 {
64 Move,
65 TouchDown,
66 TouchUp,
67 KeyDown,
68 KeyUp,
69 Wheel,
70 };
71
72 struct TouchEvent
73 {
74 EventType type;
75 int x;
76 int y;
77 int scanCode;
78 int keyCode;
79
80 void TransformToScreen(int width, int height, int theta = 0)
81 {
82 auto k = x, l = width;
83 if (90 == theta)
84 {
85 x = y;
86 y = transformScalerX - k;
87 width = height;
88 height = l;
89 }
90 else if (180 == theta)
91 {
92 x = transformScalerX - x;
93 y = transformScalerY - y;
94 }
95 else if (270 == theta)
96 {
97 x = transformScalerY - y;
98 y = k;
99 width = height;
100 height = l;
101 }
102
103 x = x * width / transformScalerX;
104 y = y * height / transformScalerY;
105 }
106 };
107
108 public:
109 ATouchEvent();
110 ~ATouchEvent();
111
112 bool GetRawEvent(input_event *event);
113
114 bool GetTouchEvent(TouchEvent *touchEvent);
115
116 public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected