Commit Graph

75 Commits

Author SHA1 Message Date
divVerent
7b11377bce
ebiten: Support updating the gamepad mapping (#1775)
This is only supported on desktops yet (on mobile standard layout isn't
implemented yet, and on the web this is the browser's responsibility).

Closes #1723
2021-08-23 21:44:49 +09:00
Hajime Hoshi
5004fdcf02 ebiten: Update comments 2021-07-20 02:53:13 +09:00
Hajime Hoshi
f192971080 ebiten: Rename HasGamepadStandardLayoutMapping -> IsStandardGamepadLayoutAvailable
Updates #1557
2021-07-20 02:46:12 +09:00
Hajime Hoshi
aa694be6f6 ebiten: Add the standard gamepad layout
This change introduces the standard gamepad layout. This changes adds
these APIs:

  * func HasGamepadStandardLayoutMapping
  * func IsGamepadStandardButtonPressed
  * func GamepadStandardAxisValue
  * type StandardGamepadButton
  * type StandardGamepadAxis

The standard gamepad layout is based on the web standard. See
https://www.w3.org/TR/gamepad/#remapping.

On desktops, the SDL's gamecontrllerdb.txt is used. If the gamepad is
listed in the text file, the mapping works. GLFW's mapping featrue is
not used.

On browsers, the property of a gamepad 'mapping' is used. When the
mapping value is 'standard', the gamepad is recognized to have the
standard mapping.

On mobiles, the implementation is still WIP.

Updates #1557
2021-07-20 01:32:28 +09:00
Hajime Hoshi
f882dbda77 ebiten: Fix comments 2021-07-20 01:12:17 +09:00
Hajime Hoshi
dbcb220742 ebiten: Add GamepadAxisValue replacing GamepadAxis
Updates #1718
Closes #1719
2021-07-19 01:22:35 +09:00
Hajime Hoshi
bd5cc145df ebiten: Refactoring: Use aliases for GamepadButton and MouseButton 2021-07-19 00:57:35 +09:00
Hajime Hoshi
6bc22d4587 Unify 'deprecated' comment formats 2021-07-10 03:19:23 +09:00
Hajime Hoshi
431cd33839 ebiten: Add AppendInputChars, AppendGamepadIDs, and AppendTouchIDs
These functions reduce unnecessary allocations of arrays.

Closes #1692
2021-07-10 03:03:24 +09:00
Hajime Hoshi
99a6b1b03e internal/driver: Change some functions to Append*
Updates #1692
2021-07-10 01:52:21 +09:00
Hajime Hoshi
26bb1b5f31 ebiten: Refactoring: Stop using TouchIDs in TouchPosition 2021-07-10 01:38:54 +09:00
Hajime Hoshi
4398a5e227 ebiten: Change the key name convention to follow the Web standard
Closes #1394
2021-04-14 22:49:07 +09:00
Hajime Hoshi
4c22314b3a ebiten: Remove old comments 2021-04-14 00:21:15 +09:00
Hajime Hoshi
0246a6407e ebiten: Guarantee that CursorPosition returns (0, 0) in the very initial state on desktops
This change also guarantees that CursorPosition always returns (0, 0)
on mobiles.
2021-04-07 03:08:09 +09:00
Hajime Hoshi
763ed32ca6 ebiten: Update input API comments for Android
Closes #1539
2021-03-14 18:02:55 +09:00
Hajime Hoshi
14070ee153 uidriver: Copy the runes on the callee sides 2020-11-18 19:37:12 +09:00
Hajime Hoshi
5ee3fdf628 ebiten: Add KeySuper
Fixes #1382
2020-10-11 18:40:40 +09:00
Hajime Hoshi
b1c67c7661 ebiten: Introduce type TouchID
Fixes #604
2020-10-10 03:57:47 +09:00
Hajime Hoshi
809b7a3afa ebiten: Introduce type GamepadID
Updates #604
2020-10-08 01:57:08 +09:00
Hajime Hoshi
83ead375a4 ebiten: Update comments 2020-10-05 02:00:50 +09:00
Hajime Hoshi
1d4ff9a906 ebiten: Remove the deprecated functions and constants
Updates #1127
2020-10-04 04:47:24 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
raa0121
e3e8b49047
ebiten: Add inpututil guide comments for Is{Key,MouseButton,Gamepad}Pressed and TouchIDs (#1346)
Fixes #1344
2020-09-15 19:29:07 +09:00
Hajime Hoshi
a1ac574a60 docs: Use 'Deprecated:' annotation
Fixes #1160
2020-05-19 01:50:55 +09:00
Hajime Hoshi
fd69f58dae input: Add comments about mobiles
Updates #237
Updates #1090
2020-02-23 02:09:28 +09:00
corfe83
a18cddb39f
Reduce heap allocations in thread.go and input.go (#1085)
I've been doing some profiling of a very simple ebiten project, and noticed that thread.go was doing a bunch of unnecessary allocations to accomplish its work. This change seeks to reduce GC work.

Input.go was also doing some unnecessary allocations.

The thread.go change reduces the total number of allocations per frame from 1342 to 852 (~36% reduction). The input.go change reduces it further to 752 (~44% total reduction). Perf tests were done on windows.
2020-02-21 09:59:45 +09:00
Hajime Hoshi
5b7151595b mobile/ebitenmobileview: Handle keyboard keys on Android (ebitenmobile)
Updates #237
2020-02-20 01:53:51 +09:00
Hajime Hoshi
b4819c4523
input: Rename GamepadGUID -> GamepadSDLID (#1049)
Gamepad GUID is a SDL specific notion and, strictly speaking,
they are not GUID (UUID) since they don't follow UUID's
specifications.

Renaming the function makes the situation clearer.

Updates #1048
2020-01-11 15:50:37 +09:00
Hajime Hoshi
dcad3d21c9 ui: Format comments 2020-01-09 23:05:29 +09:00
Jake Bentvelzen
c17946bb82 ui: Add GamepadGUID and GamepadName functions (#1035)
Fixes #1034
2020-01-09 22:11:32 +09:00
Hajime Hoshi
52900fac79 Move back driver getters to ebiten package 2019-09-03 01:46:11 +09:00
Hajime Hoshi
83b2d4b112 input: driver.Key now distinguishes left/right modifier keys
This is a preparation for event package, that will have key enum.

Updates #926
2019-09-01 23:49:00 +09:00
Hajime Hoshi
de915a1736 Move driver getters to graphicsdriver/uidriver packages
This enables to add internal functions to these packages so that
the driver selector logics can be modified.
2019-08-01 00:40:59 +09:00
Hajime Hoshi
f262210410 input: Improve CursorPosition document 2019-04-13 12:46:32 +09:00
Hajime Hoshi
0aa3135082 driver: Remove UI.AdjustPosition 2019-04-07 19:31:49 +09:00
Hajime Hoshi
a1697feeb1 driver: Add UI.Input() 2019-04-07 18:37:54 +09:00
Hajime Hoshi
7e5085f15b Add uidriver package and move UI implementation to this packaage 2019-04-07 18:21:16 +09:00
Hajime Hoshi
06219db2cc input: Replace Touches with TouchIDs and TouchPosition 2019-03-31 02:59:48 +09:00
Hajime Hoshi
0536efd95f ui: Remove AdjustedCursorPosition 2019-03-31 02:06:42 +09:00
Hajime Hoshi
dec6be1a11 ui: Remove AdjustedTouches 2019-03-31 02:03:59 +09:00
Hajime Hoshi
43ec1e7fb3 input: Refactoring: Make Touch a struct 2019-03-31 01:14:49 +09:00
Hajime Hoshi
7dca1889a1 input: Move Key to driver package 2019-03-30 23:39:56 +09:00
Hajime Hoshi
c5a8c88e2d input: Move MouseButton and GamepadButton to driver package 2019-03-30 23:19:52 +09:00
Hajime Hoshi
7e604c6890 input: Fix comments 2018-10-11 22:36:38 +09:00
Hajime Hoshi
237f6a2014 input: Rename MouseWheel -> Wheel 2018-09-30 17:01:45 +09:00
Hajime Hoshi
d752408da3 Fix comments not to use the term 'this function' 2018-07-15 01:04:46 +09:00
Philipp Steinhaus
39b3170185 input: Enable mouse wheel input (#628) 2018-06-18 00:38:30 +09:00
Hajime Hoshi
fbeed96bb5 input: Add TouchIDs and TouchPosition (#497)
This change deprecates Touch interface and Touches function.
2018-05-07 00:31:46 +09:00
Hajime Hoshi
e4ee3100db ui: Fix comments 2018-04-30 03:58:04 +09:00
Evan Leis
7172e98a31 input: Do not allocate a touch slice if no touches have been made (#587)
Touches() will always allocate a new slice to copy touches into even if no touches are reported, for example on desktop. Adding a simple check makes sure that this unnecessary allocation does not happen.
2018-04-23 23:52:50 +09:00