Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gamepad registration methods public #4912

Closed

Conversation

alice-i-cecile
Copy link
Member

@alice-i-cecile alice-i-cecile commented Jun 3, 2022

Objective

Solution

  • make register and deregister public
  • while I'm here:
    • make the APIs more consistent / correct
    • improve the docs a bit

Changelog

Users can now directly manually register and deregister gamepads. This functionality is primarily useful for testing.

///
/// [`Gamepad`]s are registered and deregistered in [`gamepad_connection_system`]
/// [`Gamepad`]s are registered and deregistered in [`gamepad_connection_system`],
/// based on the [`GamepadEvent`]s provided by the system.
pub struct Gamepads {
gamepads: HashSet<Gamepad>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deliberately decided to avoid making this field public for now: the provided methods are more ergonomic and adequately powerful.

This also lets us optimize this to some flavor of small set in the future without breaking this bit of public API.

@alice-i-cecile alice-i-cecile added A-Input Player input via keyboard, mouse, gamepad, and more C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR labels Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
1 participant