MCPcopy Create free account
hub / github.com/diasurgical/devilution / preprocess_events

Function preprocess_events

SourceX/controls/touch.cpp:89–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static void preprocess_events(SDL_Event *event)
90{
91 // Supported touch gestures:
92 // left mouse click: single finger short tap
93 // right mouse click: second finger short tap while first finger is still down
94 // pointer motion: single finger drag
95 // left button drag and drop: dual finger drag
96 // right button drag and drop: triple finger drag
97 if (event->type != SDL_FINGERDOWN && event->type != SDL_FINGERUP && event->type != SDL_FINGERMOTION) {
98 return;
99 }
100
101 // front (0) or back (1) panel
102 SDL_TouchID port = event->tfinger.touchId;
103 if (port != 0) {
104 return;
105 }
106
107 switch (event->type) {
108 case SDL_FINGERDOWN:
109 preprocess_finger_down(event);
110 break;
111 case SDL_FINGERUP:
112 preprocess_finger_up(event);
113 break;
114 case SDL_FINGERMOTION:
115 preprocess_finger_motion(event);
116 break;
117 }
118}
119
120static void preprocess_finger_down(SDL_Event *event)
121{

Callers 1

handle_touchFunction · 0.85

Calls 3

preprocess_finger_downFunction · 0.85
preprocess_finger_upFunction · 0.85
preprocess_finger_motionFunction · 0.85

Tested by

no test coverage detected