[Merged by Bors] - feat: add GamepadInfo, expose gamepad names#6342
Closed
dataphract wants to merge 2 commits intobevyengine:mainfrom
Closed
[Merged by Bors] - feat: add GamepadInfo, expose gamepad names#6342dataphract wants to merge 2 commits intobevyengine:mainfrom
dataphract wants to merge 2 commits intobevyengine:mainfrom
Conversation
crates/bevy_input/src/gamepad.rs
Outdated
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||
| pub struct GamepadInfo { | ||
| name: String, |
Member
There was a problem hiding this comment.
IMO this isn't high risk; we can just make the field pub and simplify the API dramatically.
alice-i-cecile
requested changes
Oct 22, 2022
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
Nice, that really was easy.
LGTM once you make the field(s) of GamepadInfo public :)
Member
|
@terhechte, can you review this? Does this meet your needs? |
terhechte
approved these changes
Oct 22, 2022
terhechte
left a comment
There was a problem hiding this comment.
This looks great. Thanks for the implementation @dataphract
alice-i-cecile
approved these changes
Oct 23, 2022
Member
|
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Oct 24, 2022
# 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:  After:  --- ## 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.
Contributor
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 28, 2022
# Objective Fixes bevyengine#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:  After:  --- ## 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.
Pietrek14
pushed a commit
to Pietrek14/bevy
that referenced
this pull request
Dec 17, 2022
# Objective Fixes bevyengine#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:  After:  --- ## 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.
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
# Objective Fixes bevyengine#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:  After:  --- ## 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fixes #6339.
Solution
This PR adds a new type,
GamepadInfo, which holds metadata associated with a particularGamepad. TheGamepadsresource now holds aHashMap<Gamepad, GamepadInfo>. TheGamepadInfois created when the gamepad backend (by defaultbevy_gilrs) emits a "gamepad connected" event.The
gamepad_viewerexample has been updated to showcase the new functionality.Before:
After:
Changelog
Added
GamepadInfo.Gamepads::name(), which returns the name of the specified gamepad if it exists.Changed
GamepadEventType::Connectedis now a tuple variant with a single field of typeGamepadInfo.GamepadInfois notCopy,GamepadEventTypeis no longerCopy. The same is true ofGamepadEventandGamepadEventRaw.Migration Guide
GamepadEventType::Connectedwill need to be updated, as the form of the variant has changed.GamepadEvent,GamepadEventRaworGamepadEventTypeto beCopywill need to be updated.