Skip to content

Commit

Permalink
Make Sure Gampad Axis Value Is Within Deadzone (#232)
Browse files Browse the repository at this point in the history
* Make Sure Gampad Axis Value Is Within Deadzone

* Fix Clippy Warnings About Deriving Eq

* Bump Crate Version and Update Changelog
  • Loading branch information
zicklag committed Aug 21, 2022
1 parent b95dd21 commit ef037f9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "leafwing-input-manager"
description = "A powerfully direct stateful input manager for the Bevy game engine."
version = "0.5.1"
version = "0.5.2"
authors = ["Leafwing Studios"]
homepage = "https://leafwing-studios.com/"
repository = "https://github.com/leafwing-studios/leafwing-input-manager"
Expand Down
7 changes: 7 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## Version 0.5.2

### Bug fixes

- Fixed gamepad axes not filtering out inputs outside of the axis deadzone.
- Fixed `DualAxis::right_stick()` returning the y axis for the left stick.

## Version 0.5.1

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion src/action_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ pub struct ActionStateDriver<A: Actionlike> {
///
/// This struct is principally used as a field on [`ActionData`],
/// which itself lives inside an [`ActionState`].
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct Timing {
/// The [`Instant`] at which the button was pressed or released
/// Recorded as the [`Time`](bevy::core::Time) at the start of the tick after the state last changed.
Expand Down
2 changes: 1 addition & 1 deletion src/input_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use std::marker::PhantomData;
/// // Removal
/// input_map.clear_action(Action::Hide);
///```
#[derive(Component, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Component, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default)]
pub struct InputMap<A: Actionlike> {
/// The raw vector of [PetitSet]s used to store the input mapping,
Expand Down
7 changes: 5 additions & 2 deletions src/input_streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,12 @@ impl<'a> InputStreams<'a> {
match single_axis.axis_type {
AxisType::Gamepad(axis_type) => {
if let Some(gamepad) = self.guess_gamepad() {
self.gamepad_axes
let value = self
.gamepad_axes
.get(GamepadAxis { gamepad, axis_type })
.unwrap_or_default()
.unwrap_or_default();

value_in_axis_range(single_axis, value)
} else {
0.0
}
Expand Down

0 comments on commit ef037f9

Please sign in to comment.