Mobile touch: system edges, per-finger cancel, long-press sort

Interaction ideas from jhaizhou-ops/d2r-mobile (MIT), no code taken:
- world fingers in the bottom safe inset (gesture bar) are ignored
- SDL_EVENT_FINGER_CANCELED cancels one finger; a cancelled joystick
  keeps its vector for 300 ms and a finger near the old base re-acquires it
- attack taps shorter than a frame release on the next Update
- cancelled UI touches and world taps park the pointer (no hover residue)
- long press on an empty inventory cell offers the original sort

Desktop ctest 59/59; sort sheet verified on the device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-13 11:42:44 +09:00
co-authored by Claude Opus 5.5
parent c132891aef
commit ae713a0772
11 changed files with 320 additions and 30 deletions
+5
View File
@@ -1,5 +1,9 @@
// Touch mode in the original GameWindow: the mobile HUD must leave the joystick / attack zones and
// open world to the touch router, while real UI (HUD buttons) still takes the finger.
// The checks are assert()s; keep them in release builds.
#ifdef NDEBUG
#undef NDEBUG
#endif
#include "python_runtime.h"
#include "python_gameplay_modules.h"
#include "app/input/touch_router.h"
@@ -117,6 +121,7 @@ int main(int argc, char** argv) {
runtime.execute("game.interface.wndMobileHUD.combat_wheel.OnUpdate()\n"
"assert game.interface.wndMobileHUD.combat_wheel.attack_pressed\n"
"game.interface.wndMobileHUD.joystick.OnUpdate()\n");
router.Update(100); // a frame has seen the held key
router.FingerUp(2, layout.attack_x, layout.attack_y, 200);
router.FingerUp(1, 160.0f + layout.joy_radius, H - 180.0f, 220);
assert(!sink.attack && !ava2::GetPlayerMovementYaw(0.0f, yaw));