bevy/examples/input
dataphract bcc33f6757 feat: add GamepadInfo, expose gamepad names (#6342)
# Objective

Fixes #6339.

## Solution

This PR adds a new type, `GamepadInfo`, which holds metadata associated with a particular `Gamepad`. The `Gamepads` resource now holds a `HashMap<Gamepad, GamepadInfo>`. The `GamepadInfo` is created when the gamepad backend (by default `bevy_gilrs`) emits a "gamepad connected" event.

The `gamepad_viewer` example has been updated to showcase the new functionality.

Before:

![bevy-gamepad-old](https://user-images.githubusercontent.com/86984145/197359427-2130a3c0-bd8a-4683-ae24-2a9eaa98b586.png)

After:

![bevy-gamepad-new](https://user-images.githubusercontent.com/86984145/197359429-f7963163-df26-4906-af7f-6186fe3bd338.png)


---

## Changelog

### Added

- Added `GamepadInfo`.
- Added `Gamepads::name()`, which returns the name of the specified gamepad if it exists.

### Changed

- `GamepadEventType::Connected` is now a tuple variant with a single field of type `GamepadInfo`.
- Since `GamepadInfo` is not `Copy`, `GamepadEventType` is no longer `Copy`. The same is true of `GamepadEvent` and `GamepadEventRaw`.

## Migration Guide

- Pattern matches on `GamepadEventType::Connected` will need to be updated, as the form of the variant has changed.
- Code that requires `GamepadEvent`, `GamepadEventRaw` or `GamepadEventType` to be `Copy` will need to be updated.
2022-10-24 14:33:50 +00:00
..
char_input_events.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
gamepad_input.rs Gamepad type is Copy; do not require / return references to it in Gamepads API (#5296) 2022-09-03 20:08:54 +00:00
gamepad_input_events.rs feat: add GamepadInfo, expose gamepad names (#6342) 2022-10-24 14:33:50 +00:00
keyboard_input.rs Miscellaneous code-quality improvements. (#5860) 2022-09-05 00:30:21 +00:00
keyboard_input_events.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
keyboard_modifiers.rs Miscellaneous code-quality improvements. (#5860) 2022-09-05 00:30:21 +00:00
mouse_grab.rs Update wgpu to 0.14.0, naga to 0.10.0, winit to 0.27.4, raw-window-handle to 0.5.0, ndk to 0.7 (#6218) 2022-10-19 17:40:23 +00:00
mouse_input.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
mouse_input_events.rs Miscellaneous code-quality improvements. (#5860) 2022-09-05 00:30:21 +00:00
touch_input.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
touch_input_events.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00