diff --git a/examples/game_controller.rs b/examples/game_controller.rs index e66a3f83..a2e81216 100644 --- a/examples/game_controller.rs +++ b/examples/game_controller.rs @@ -52,7 +52,8 @@ fn main() { // Axis motion is an absolute value in the range // [-32768, 32767]. Let's simulate a very rough dead // zone to ignore spurious events. - if val.abs() > 10000 { + let dead_zone = 10000; + if val.abs() > dead_zone || val.abs() < -dead_zone { println!("Axis {:?} moved to {}", axis, val); } } diff --git a/examples/joystick.rs b/examples/joystick.rs index a7e87020..3a3bef03 100644 --- a/examples/joystick.rs +++ b/examples/joystick.rs @@ -39,7 +39,8 @@ fn main() { // Axis motion is an absolute value in the range // [-32768, 32767]. Let's simulate a very rough dead // zone to ignore spurious events. - if val.abs() > 10000 { + let dead_zone = 10000; + if val.abs() > dead_zone || val.abs() < -dead_zone { println!("Axis {} moved to {}", axis_idx, val); } }