Commit Graph

47 Commits

Author SHA1 Message Date
Hajime Hoshi
c5e47c7166 inpututil: bug fix: AppendJustReleasedGamepadButtons and AppendJustReleasedStandardGamepadButtons returned just-pressed buttons
Closes #3147
2024-10-26 17:32:37 +09:00
Hajime Hoshi
82f2319020 internal/hook: rename hooks -> hook 2023-10-06 13:58:00 +09:00
Kacper Drobny
6e12fd13e4
ebiten: add additional MouseButtons (#2467)
Closes #2445
2022-11-23 04:28:34 +09:00
Hajime Hoshi
685a6acb05 inpututil: add comments about Update
All the inpututil functions treating durations must be called Update,
or users cannot get correct results.

This is really a bad designed API, and we should revisit this later.

Closes #2462
2022-11-20 14:28:42 +09:00
Ronnie
913a03e247
inpututil: add new APIs for keys and gamepads (#2383)
This change adds these APIs:

* `AppendJustPressedKeys`
* `AppendJustReleasedKeys`
* `AppendPressedGamepadButtons`
* `AppendJustPressedGamepadButtons`
* `AppendJustReleasedGamepadButtons`
* `AppendPressedStandardGamepadButtons`
* `AppendJustPressedStandardGamepadButtons`
2022-10-12 16:21:52 +09:00
Hajime Hoshi
bcba362e7e inpututil: add AppendJustReleasedTouchIDs and TouchPreviousPosition
Closes #2057
2022-08-16 02:21:55 +09:00
Hajime Hoshi
8aeda9f543 inpututil: bug fix: out of range at scanning buttons
Updates #2169
2022-06-29 15:55:08 +09:00
Hajime Hoshi
9cfa84ddaa inpututil: fix the comments
The unit of time is ticks, not frames.

Closes #2087
2022-05-06 20:42:41 +09:00
Hajime Hoshi
03bf60cd92 inpututil: revert inpututil changes
This reverts these commits:
* 0fd630100f
* 798b60b67c
* 5bb22d2bcf

Reason: this change is no longer needed.

Updates #2027
Updates #2039
2022-04-01 02:24:53 +09:00
divVerent
0fd630100f
inpututil: allow an arbitrary number of gamepad buttons. (#2031)
Fixes crash in inpututil when a gamepad with more than "allowed" buttons is
connected.

Closes #2027
2022-03-26 20:25:41 +09:00
Hajime Hoshi
798b60b67c inpututil: bug fix: compile error 2022-03-25 14:36:34 +09:00
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