emulators-ui and js-dos bundles support configuring touch controls for mobile. It can map simple gestures like: left, right, up, down swipes and tap for two fingers.
To enable gestures support, you need to add
gestures section in jsdos.json.
In that case js-dos will automatically configure gestures support.
You can directly create
nipple control like in Digger example.
Each gesture should conform following interface:
For example, digger configuration is:
- Moving finger up will map to key "UP".
- Moving finger left will map to key "LEFT".
- Moving finger right will map to key "RIGHT".
- Moving finger down will map to key "DOWN".
- Tap with finger will map to key "F1"
When a direction is reached after the threshold. Direction are split with a 45° angle.
When a plain direction is reached after the threshold. Plain directions are split with a 90° angle.
Synthetic gesture, means that the key pressed by (dir or plain) should be released at the end of gesture. By default it will be pressed until a new gesture is detected.
When the user taps on the screen by finger.
You can use Game Studio to easily configure gestures.
Under the hood awesome nipplejs is used. Many thanks!