+#if defined(TARGET_SDL2)
+void HandleFingerEvent(FingerEvent *event)
+{
+#if 0
+ static int num_events = 0;
+ int max_events = 10;
+#endif
+
+#if DEBUG_EVENTS
+ Error(ERR_DEBUG, "FINGER EVENT: finger was %s, touch ID %lld, finger ID %lld, x/y %f/%f, dx/dy %f/%f, pressure %f",
+ event->type == EVENT_FINGERPRESS ? "pressed" :
+ event->type == EVENT_FINGERRELEASE ? "released" : "moved",
+ event->touchId,
+ event->fingerId,
+ event->x, event->y,
+ event->dx, event->dy,
+ event->pressure);
+#endif
+
+#if 0
+ int x = (int)(event->x * video.width);
+ int y = (int)(event->y * video.height);
+ int button = MB_LEFTBUTTON;
+
+ Error(ERR_DEBUG, "=> screen x/y %d/%d", x, y);
+#endif
+
+#if 0
+ if (++num_events >= max_events)
+ CloseAllAndExit(0);
+#endif
+
+#if 1
+#if 0
+ if (event->type == EVENT_FINGERPRESS ||
+ event->type == EVENT_FINGERMOTION)
+ button_status = button;
+ else
+ button_status = MB_RELEASED;
+
+ int max_x = SX + SXSIZE;
+ int max_y = SY + SYSIZE;
+#endif
+
+#if 1
+ if (game_status == GAME_MODE_PLAYING)
+#else
+ if (game_status == GAME_MODE_PLAYING &&
+ x < max_x)
+#endif
+ {
+ int key_status = (event->type == EVENT_FINGERRELEASE ? KEY_RELEASED :
+ KEY_PRESSED);
+#if 1
+ Key key = (event->y < 1.0 / 3.0 ? setup.input[0].key.up :
+ event->y > 2.0 / 3.0 ? setup.input[0].key.down :
+ event->x < 1.0 / 3.0 ? setup.input[0].key.left :
+ event->x > 2.0 / 3.0 ? setup.input[0].key.right :
+ setup.input[0].key.drop);
+#else
+ Key key = (y < max_y / 3 ? setup.input[0].key.up :
+ y > 2 * max_y / 3 ? setup.input[0].key.down :
+ x < max_x / 3 ? setup.input[0].key.left :
+ x > 2 * max_x / 3 ? setup.input[0].key.right :
+ setup.input[0].key.drop);
+#endif
+
+ Error(ERR_DEBUG, "=> key == %d, key_status == %d", key, key_status);
+
+ HandleKey(key, key_status);
+ }
+ else
+ {
+#if 0
+ Error(ERR_DEBUG, "::: button_status == %d, button == %d\n",
+ button_status, button);
+
+ HandleButton(x, y, button_status, button);
+#endif
+ }
+#endif
+}
+#endif
+