mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
[PR #1723] Add touch gliding #664
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/stenzek/duckstation/pull/1723
State: closed
Merged: Yes
This PR adds the functionality I requested in #1065, that is, touch gliding (for lack of a better name) for Android. The commit has been tested extensively for the better part of a day on a real phone.
This basically keeps the first button held as long as your finger keeps touching the screen. This lets you hold square and then glide/slide over to X to charge and jump as Spyro with minimal effort, using your touchscreen. It also supports multiple touch traces, perfect for games like, I don't know, Crash Team Racing (X to Circle for using items without losing speed, R1<>L1 for drifting and boosting, both can happen concurrently).
How does this work:
A map (mFirstHolds) is available for linking touch pointer IDs to button views. When you touch the screen, a pointer is made. Now, when your pointer starts on, or goes to the first button, the map saves the pointerID>buttonview combo. Any future buttons this pointer slides over are not saved in the combo, but will be activated, and when you slide away it will disable, but the first button remains on. You can do this for as many fingers as you can possibly get on the screen, and they'll be treated separately.
The moment one of your pointers let go of the screen, the combo that was mapped is deleted. When all pointers are released, the map is wholly cleared.