From c04301c11762f96683eae018df38251becf79f7b Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 4 Jan 2020 11:31:40 +0900 Subject: [PATCH] Android: Fix multi-touch detection --- android/README.md | 3 +-- src/sys/nact_input.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/android/README.md b/android/README.md index 4f216f1..177191a 100644 --- a/android/README.md +++ b/android/README.md @@ -36,13 +36,12 @@ cd system3-sdl2/android ## How to use 1. Create a ZIP file containing all the game files (`*.DAT`), and transfer it to your device. 2. When you start the app, a file chooser opens. Select the zip file. -3. The game starts. +3. The game starts. Two-finger touch is treated as a right click. 4. Game data persists in the app's internal storage. Use the device's Settings app if you want to clear it (eg. before installing another game). Note that this Android port is still in early development; see below. ## TODO -- Right-click emulation - Save / Load support - Better launcher - App icon diff --git a/src/sys/nact_input.cpp b/src/sys/nact_input.cpp index d3a7a03..60cb79f 100644 --- a/src/sys/nact_input.cpp +++ b/src/sys/nact_input.cpp @@ -8,7 +8,7 @@ #include "ags.h" #include "texthook.h" -static int mousex, mousey; +static int mousex, mousey, fingers; static bool pump_events(int screen_height) { @@ -28,6 +28,7 @@ static bool pump_events(int screen_height) case SDL_FINGERMOTION: mousex = e.tfinger.x * 640; mousey = e.tfinger.y * screen_height; + fingers = SDL_GetNumTouchFingers(e.tfinger.touchId); break; } } @@ -46,7 +47,6 @@ uint8 NACT::get_key() // キーボード&マウス const Uint8* key = SDL_GetKeyboardState(NULL); Uint32 mouse; - int fingers = SDL_GetNumTouchFingers(SDL_GetTouchDevice(0)); if (fingers) { mouse = fingers == 1 ? SDL_BUTTON_LMASK : SDL_BUTTON_RMASK; } else {