MCPcopy Create free account
hub / github.com/PerroEngine/Perro / joycon_mut

Method joycon_mut

perro_source/api_modules/perro_input_api/src/snapshot.rs:238–249  ·  view source on GitHub ↗
(&mut self, index: usize)

Source from the content-addressed store, hash-verified

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)

Callers 12

apply_queued_commandsMethod · 0.80
set_joycon_sideMethod · 0.80
set_joycon_connectedMethod · 0.80
set_joycon_calibratedMethod · 0.80
set_joycon_stickMethod · 0.80
set_joycon_stick_unitMethod · 0.80
set_joycon_gyroMethod · 0.80
set_joycon_accelMethod · 0.80

Calls 2

resize_withMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected