(
&mut self,
app: &mut S,
gilrs: &Gilrs,
id: GamepadId,
button: GamepadButton,
is_down: bool,
)
| 302 | app.set_gamepad_axis(index, mapped, value); |
| 303 | self.log_raw_like_state(gilrs, id, "axis_changed"); |
| 304 | } |
| 305 | } else { |
| 306 | self.handle_dpad_axis(app, gilrs, id, axis, value); |
| 307 | self.log_raw_like_state(gilrs, id, "dpad_axis_changed"); |
| 308 | } |
| 309 | } |
| 310 | _ => {} |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | fn set_button<S: GamepadSink>( |
| 315 | &mut self, |
| 316 | app: &mut S, |
| 317 | gilrs: &Gilrs, |
| 318 | id: GamepadId, |
| 319 | button: GamepadButton, |
| 320 | is_down: bool, |
| 321 | ) { |
| 322 | let Some(index) = self.assign_index_if_unique(gilrs, id) else { |
| 323 | return; |
| 324 | }; |
| 325 | let bit = 1u32 << (button as usize); |
| 326 | let current = self.down_masks.get(&id).copied().unwrap_or(0); |
| 327 | let was_down = (current & bit) != 0; |
| 328 | if was_down == is_down { |
| 329 | return; |
| 330 | } |
| 331 | let mut next = current; |
| 332 | if is_down { |
| 333 | next |= bit; |
| 334 | } else { |
| 335 | next &= !bit; |
| 336 | } |
no test coverage detected