bevy/crates/bevy_input/src
Carter Anderson 00c2edf7b2
Revert most of #16222 and add gamepad accessors (#16425)
# Objective

#16222 regressed the user experience of actually using gamepads:

```rust
// Before 16222
gamepad.just_pressed(GamepadButton::South)

// After 16222
gamepad.digital.just_pressed(GamepadButton::South)

// Before 16222
gamepad.get(GamepadButton::RightTrigger2)

// After 16222
gamepad.analog.get(GamepadButton::RighTrigger2)
```

Users shouldn't need to think about "digital vs analog" when checking if
a button is pressed. This abstraction was intentional and I strongly
believe it is in our users' best interest. Buttons and Axes are _both_
digital and analog, and this is largely an implementation detail. I
don't think reverting this will be controversial.

## Solution

- Revert most of #16222
- Add the `Into<T>` from #16222 to the internals
- Expose read/write `digital` and `analog` accessors on gamepad, in the
interest of enabling the mocking scenarios covered in #16222 (and
allowing the minority of users that care about the "digital" vs "analog"
distinction in this context to make that distinction)

---------

Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
Co-authored-by: Rob Parrett <robparrett@gmail.com>
2024-11-19 00:00:16 +00:00
..
axis.rs Gamepad improvements (#16222) 2024-11-04 17:05:24 +00:00
button_input.rs Revert most of #16222 and add gamepad accessors (#16425) 2024-11-19 00:00:16 +00:00
common_conditions.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
gamepad.rs Revert most of #16222 and add gamepad accessors (#16425) 2024-11-19 00:00:16 +00:00
gestures.rs bevy_input: allow use without bevy_reflect (#14167) 2024-07-08 01:09:07 +00:00
keyboard.rs Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
lib.rs Use Name component for gamepad (#16233) 2024-11-05 00:30:48 +00:00
mouse.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
touch.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00