Commit Graph

15 Commits

Author SHA1 Message Date
Hajime Hoshi
b7dd45c0e4 internal/gamepad: ignore the very first MotionEvent with 0 value for Android
On Android, MotionEvent with 0 values might come for axes when connecting
a gamepad, even though a user didn't touch any axes. This is problematic
especially for tirgger axes, where the default value should be -1.

This change fixes the issue by adding a new state `axesReady` to check
if an axis is really touched or not. If an axis is not touched yet,
a button value for a standard (trigger) button always returns 0.

This change also removes an old hack to initialize axis values for
triggers.

Closes #2598
2024-03-21 22:28:48 +09:00
divVerent
809ad991c2
internal/gamepad: refactor standard layout support to allow remapping in the per-platform implementations. (#2588)
Refactors native standard layout so standard axes and buttons can be implemented using any of axes, buttons or hats.

This is required to be able to implement a native standard layout mapping for Linux, as e.g. shoulder buttons can be
backed either by an analog or digital input.

Precedes #2587

Updates #2052
2023-03-03 23:29:04 +09:00
Hajime Hoshi
094726915b
ebiten: add IsStandardGamepadAxisAvailable and IsStandardGamepadButtonAvailable (#2241)
Closes #2040
2022-08-11 12:35:20 +09:00
Hajime Hoshi
72d5002e72 remove go2cpp support
Closes #2126
2022-08-07 22:17:53 +09:00
mattn
2bacecca24
fix typos (#2227) 2022-08-03 22:40:39 +09:00
Hajime Hoshi
847c4f067a internal/gamepad: make nativeGamepad(s) interfaces
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 21:52:48 +09:00
Hajime Hoshi
0cd43bd081 internal/gamepad: stop embedding a member into a struct
This is a preparation to switch the gamepad implementation for Xbox.

Updates #2084
2022-06-24 19:01:50 +09:00
Hajime Hoshi
8d3de6207b internal/gamepad: add a warning message when getGamepads is not available
Updates #2100
2022-05-21 23:25:56 +09:00
Hajime Hoshi
8d318fc4de internal/gamepad: bug fix: getGamepads might not be available under a non-secure context
Closes #2100
2022-05-21 23:22:50 +09:00
Hajime Hoshi
ea39fca10c internal/gamepad: rename functions *Num -> *Count 2022-02-02 02:01:46 +09:00
Hajime Hoshi
a8576008f0 internal/gamepads: refactoring: remove a struct member 2022-02-02 00:32:29 +09:00
Hajime Hoshi
f5b68e5dc1 internal/gamepad: implement for Windows
Updates #1452
Updates #1764
2022-02-01 13:23:05 +09:00
Hajime Hoshi
e261951946 internal/gamepad: remove nativeGamepad.present 2022-01-30 18:59:25 +09:00
Hajime Hoshi
71e17efd80 internal/gamepad: simplify the implementation by making the APIs concurrent-unsafe 2022-01-29 02:07:15 +09:00
Hajime Hoshi
5edfd1b743 internal/gamepad: move the implementation of gamepad for GOOS=js
Updates #1957
2022-01-29 01:44:42 +09:00