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

Allow mocking inputs for Gamepad #16221

Closed
Shatur opened this issue Nov 3, 2024 · 0 comments · Fixed by #16222
Closed

Allow mocking inputs for Gamepad #16221

Shatur opened this issue Nov 3, 2024 · 0 comments · Fixed by #16222
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 P-Regression Functionality that used to work but no longer does. Add a test for this!
Milestone

Comments

@Shatur
Copy link
Contributor

Shatur commented Nov 3, 2024

What problem does this solve or what need does it fill?

After #15685 it became inconvenient to mock inputs. On 0.14 we could call set_pressed or set. But these methods are no longer exposed.

It's still possible to do this by sending events, but it's inconsistent with the rest of the input and not very ergonomic.

What solution would you like?

I would like to bring back set_pressed and set.

Additional context

There is a similar issue regardless gamepad creation that predates the gamepads rework: #4911. Could be solved by adding a constructor for Gamepad component.

@Shatur Shatur added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 3, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Nov 3, 2024
@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 P-Regression Functionality that used to work but no longer does. Add a test for this! and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 3, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 4, 2024
# Objective

Closes #16221.

## Solution

- Make `Gamepad` fields public and remove delegates / getters.
- Move `impl Into` to `Axis` methods (delegates for `Axis` used `impl
Into` to allow passing both `GamepadAxis` and `GamepadButton`).
- Improve docs.

## Testing

- I run tests.

Not sure if the migration guide is needed, since it's a feature from RC,
but I wrote it just in case.

---

## Migration Guide

- `Gamepad` fields are now public.
- Instead of using `Gamepad` delegates like `Gamepad::just_pressed`,
call these methods directly on the fields.

---------

Co-authored-by: Alice Cecile <[email protected]>
mockersf pushed a commit that referenced this issue Nov 5, 2024
# Objective

Closes #16221.

## Solution

- Make `Gamepad` fields public and remove delegates / getters.
- Move `impl Into` to `Axis` methods (delegates for `Axis` used `impl
Into` to allow passing both `GamepadAxis` and `GamepadButton`).
- Improve docs.

## Testing

- I run tests.

Not sure if the migration guide is needed, since it's a feature from RC,
but I wrote it just in case.

---

## Migration Guide

- `Gamepad` fields are now public.
- Instead of using `Gamepad` delegates like `Gamepad::just_pressed`,
call these methods directly on the fields.

---------

Co-authored-by: Alice Cecile <[email protected]>
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 P-Regression Functionality that used to work but no longer does. Add a test for this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants