(&mut self, index: usize)
| 236 | |
| 237 | /// Return a mutable gamepad slot, creating empty slots as needed. |
| 238 | #[inline] |
| 239 | pub fn gamepad_mut(&mut self, index: usize) -> &mut GamepadState { |
| 240 | if self.gamepads.len() <= index { |
| 241 | self.gamepads.resize_with(index + 1, GamepadState::new); |
| 242 | } |
| 243 | &mut self.gamepads[index] |
| 244 | } |
| 245 | |
| 246 | /// Return a mutable Joy-Con slot, creating empty slots as needed. |
| 247 | #[inline] |
| 248 | pub fn joycon_mut(&mut self, index: usize) -> &mut JoyConState { |
| 249 | if self.joycons.len() <= index { |
| 250 | self.joycons.resize_with(index + 1, || { |
| 251 | if index.is_multiple_of(2) { |
| 252 | JoyConState::new(JoyConSide::LJoyCon) |
no test coverage detected