Commit Graph

36 Commits

Author SHA1 Message Date
Hajime Hoshi 5bb22d2bcf inpututil: bug fix: GamepadButtonNum can exceed GamepadButtonMax
Closes #2027
2022-03-25 14:31:12 +09:00
Hajime Hoshi 51f83b1527 inpututil: Add APIs for the standard gamepad layout
This change adds these APIs to inpututil:

  * IsStandardGamepadButtonJustPressed
  * IsStandardGamepadButtonJustReleased
  * StandardGamepadButtonPressDuration

Closes #1557
2021-07-20 02:37:12 +09:00
Hajime Hoshi 5c4885c988 inpututil: Add AppendJustConnectedTouchIDs
Closes #1705
2021-07-10 23:30:04 +09:00
Hajime Hoshi e8ea4046cb inpututil: Add AppendJustConnectedGamepadIDs
Updates #1705
2021-07-10 22:32:19 +09:00
Hajime Hoshi a79c287bb7 inpututil: Add AppendPressedKeys
Updates #1705
2021-07-10 22:18:15 +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 0fcf5c8470 inpututil: Add PressedKeys
Closes #770
2021-04-07 01:50:39 +09:00
Hajime Hoshi b859db02e5 inpututil: Remove map/slice allocations in update 2021-01-31 04:22:50 +09:00
Hajime Hoshi 2b77b57b75 inpututil: Optimization 2021-01-25 00:31:32 +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 bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
seebs 982a68e5a2 inpututil: use slices for maps where keys are small contiguous integers (#1169)
Durations for key presses and gamepad button presses were being stored
in map[int]int, where the key values were always small integers, and
furthermore, were always contiguous and contained the whole set. It's
much faster and cheaper to do those with slices.

We could probably do this with mouse buttons, but I was wary of that
code because I don't see any handling for more-than-three-button
mice. Similar logic could perhaps apply to touch events, but there
it might make more sense to use a dynamic allocation of some kind.

It might be more efficient to just swap the two slices back and
forth, computing the new values from the previous values and
then swapping the slice arrays themselves, but that seemed like
a more intrusive change.
2020-05-25 03:20:21 +09:00
Hajime Hoshi da5430e4b1 inpututil: Package inpututil is no longer experimental 2018-05-14 01:32:55 +09:00
Hajime Hoshi 59dc58a74c inpututil: Bug fix: prevGamepadButtondDurations was not copied correctly 2018-05-11 02:45:09 +09:00
Hajime Hoshi 5677c8a916 inpututil: Bug fix: prevTouchDurations was not updated correctly 2018-05-11 01:44:29 +09:00
Hajime Hoshi 92631e64ed Remove internal/sync
nosync package for GopherJS is problematic since nosync's mutex
assumes that Lock call is never duplicated, which is not true in
actual applications.

See also #603.
2018-05-09 23:41:08 +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 154d663d81 inpututil: Rename TouchDuration -> TouchPressDuration 2018-04-30 20:23:58 +09:00
Hajime Hoshi db3effe65a inpututil: Rename JustPressedTouches -> JustPressedTouchIDs 2018-04-30 20:07:27 +09:00
Hajime Hoshi a355d701ad inpututil: Replace JustDisconnectedGamepadIDs with IsGamepadJustDisconnected (#505) 2018-04-30 04:35:10 +09:00
Hajime Hoshi c9a244f498 inpututil: Admit some functions to return nil 2018-04-30 03:03:12 +09:00
Hajime Hoshi e33ca9a4c1 inpututil: Add comments 2018-04-30 02:52:56 +09:00
Hajime Hoshi 9d57350a42 inpututil: Add JustConnectedGamepadIDs / JustDisconnectedGamepadIDs
Fixes #505
2018-04-30 02:51:38 +09:00
Hajime Hoshi 7a94b49a33 inpututil: Make JustPressedTouches deterministic 2018-04-30 02:43:08 +09:00
Hajime Hoshi 8c258cce7d inpututil: Rename states -> durations 2018-04-30 02:19:53 +09:00
Hajime Hoshi f1fa8804d3 inpututil: Add JustPressedTouches and remove IsJustTouched
Fixes #576
2018-04-08 04:59:13 +09:00
Hajime Hoshi 1b0e71765f internal/hooks: Rename Update -> BeforeUpdate 2018-03-15 02:50:10 +09:00
Hajime Hoshi e7f1623001 inpututil: Bug fix: Init prevTouchStates 2018-02-17 04:07:16 +09:00
Hajime Hoshi d3f573523a inpututil: Add IsTouchJustReleased (#504) 2018-02-17 03:58:19 +09:00
Hajime Hoshi debe4735cd inpututil: Add IsGamepadButtonJustReleased (#504) 2018-02-17 03:52:05 +09:00
Hajime Hoshi 381aab0a91 inpututil: Add comments about concurrent safety 2018-02-17 03:12:58 +09:00
Hajime Hoshi 87f207d862 inpututil: Add IsKeyJustReleased and IsMouseButtonJustReleased (#504) 2018-02-17 03:10:53 +09:00
Hajime Hoshi 37b27d3a2d inpututil: Bug fix: delete gamepad data that doesn't exist 2018-02-05 23:45:43 +09:00
Hajime Hoshi 21a83f5ace inpututil: Bug fix: for-loop range was wrong (#415) 2018-02-04 23:18:09 +09:00
Hajime Hoshi 7aba5bd8d6 Add package inpututil (#415) 2018-02-04 17:51:03 +09:00