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

gamepad: expose raw and filtered gamepad events. #711

Merged
merged 1 commit into from
Oct 21, 2020

Conversation

cart
Copy link
Member

@cart cart commented Oct 21, 2020

The latest gamepad event changes made gamepad events have jitter (due to exposing the raw values). This changes that to use the gamepad settings to filter events. We now have GamepadEvent (filtered) and GamepadeEventRaw (unfiltered).

I also renamed gamepad-related types like XSetting to XSettings and made some example changes to improve clarity and terseness.

@simpuid

@simpuid
Copy link
Contributor

simpuid commented Oct 21, 2020

As I said earlier, the default values for AxisSettings and ButtonAxisSettings are arbitrary (rest are taken from gilrs). We need to adjust them by testing it.
The current filter function is something like this
current

However some users may want it like this(no sudden jumps in values)
alternative

I am not that much familiar with the functional programming aspect of rust. Maybe we can use a filter lambda or Box<dyn FilterTrait> to support user defined filters.
Or I am thinking too much.

@cart
Copy link
Member Author

cart commented Oct 21, 2020

Users that don't want the defaults can always change them in the GamepadSettings. For now I think we give adequate control, but I'm open to adding user configured filters to GamepadSettings. Users can also consume GamepadEventRaw directly if they can't make the filtered events work for them (which I doubt).

The main issue that this pr addresses is that the user-facing events don't line up with our high level api, which I consider to be problematic.

@cart
Copy link
Member Author

cart commented Oct 21, 2020

If we can find better default values thats definitely cool, but thats out of scope for this pr imo

@cart cart merged commit 267599e into bevyengine:master Oct 21, 2020
@karroffel karroffel added C-Feature A new feature, making something new possible A-Input Player input via keyboard, mouse, gamepad, and more labels Oct 22, 2020
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-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants