ebiten icon indicating copy to clipboard operation
ebiten copied to clipboard

Gesture detection: high-level API for touch input

Open sedyh opened this issue 1 year ago • 6 comments

Operating System

  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] FreeBSD
  • [ ] OpenBSD
  • [X] Android
  • [X] iOS
  • [X] Nintendo Switch
  • [ ] Xbox
  • [X] Web Browsers

What feature would you like to be added?

At the moment, support for the touch is at a fairly low level. Because of this, most of the applications that come out under wasm almost always do not have touch support.

I suggest discussing the API for gesture detection based on the example we already have: https://github.com/hajimehoshi/ebiten/blob/main/examples/touch/main.go

It would probably be great to call it in the same format as we are currently checking the pressed keys. I'll try to make something like this later:

func IsTapping() (event Tap, ok bool) {}
func IsPanning() (event Pan, ok bool) {}
func IsPinching() (event Pinch, ok bool) {}
func IsSwiping() (event Swap, ok bool) {}

Why is this needed?

This will contribute to the support of the touch in a much larger number of games than now.

sedyh avatar Feb 06 '23 11:02 sedyh