Commit Graph

24 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
Hajime Hoshi
95b4eeafce all: remove unnecessary build tag restrictions 2023-10-01 23:27:57 +09:00
Hajime Hoshi
7998e4d31d update purego to v0.3.0-alpha
There are breaking changes between purego v0.2.0 and v0.3.0-alpha.
2023-03-04 01:22:54 +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
Pierre Curto
4de807cc44
all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
TotallyGamerJet
4a569be6f6
internal/gamepad: remove Cgo on darwin (#2330)
Updates #1162
2022-09-16 00:11:59 +09:00
Hajime Hoshi
7d6ee39c15 internal/gamepad: bug fix: a wireless Xbox controller didn't work correctly on macOS
The button and hat values must be adjusted by their minimum values.
See also GLFW's implementation.

Closes #266
2022-09-12 01:55:05 +09:00
Hajime Hoshi
e7c0a121c4 all: remove the build tag 'ebitencbackend'
This also automatically enables 'egl' when 'nintendosdk' is specified.

Updates #2242
2022-08-12 13:15:39 +09:00
Hajime Hoshi
dac6548c0c all: rename ebitenginecbackend to nintendosdk
Updates #2242
2022-08-12 02:05:29 +09:00
Hajime Hoshi
094726915b
ebiten: add IsStandardGamepadAxisAvailable and IsStandardGamepadButtonAvailable (#2241)
Closes #2040
2022-08-11 12:35:20 +09:00
Hajime Hoshi
428b1263d9 add ebitenginecbackend build tag besides ebitencbackend
Updates #2111
Updates #2190
2022-07-09 15:23:52 +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
bf1cb035eb internal/gamepad: port the gamepad part for c-backend 2022-02-05 19:11:57 +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
96ddec1753 internal/gamepad: refactoring reorder implementations for consistency 2022-02-01 13:54:33 +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
1d59023649 internal/gamepad: make the APIs concurrent-safe again 2022-01-29 03:41:47 +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
Hajime Hoshi
a049c403cf internal/gamepad: bug fix: go-vet failed (misuse of unsafe.Pointer)
Updates #1452
2022-01-23 02:08:30 +09:00
Hajime Hoshi
ff24f7718c internal/uidriver/glfw: use an original implementation for macOS
Updates #1452
2022-01-23 01:48:24 +09:00