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

Method sync_buttons

perro_source/render_stack/perro_app/src/input/gamepad.rs:446–462  ·  view source on GitHub ↗
(&mut self, app: &mut S, gilrs: &Gilrs)

Source from the content-addressed store, hash-verified

444 &mut self,
445 app: &mut S,
446 gilrs: &Gilrs,
447 id: GamepadId,
448 button: Button,
449 value: f32,
450 ) {
451 let axis = match button {
452 Button::LeftTrigger2 => Some(GamepadAxis::LeftTrigger),
453 Button::RightTrigger2 => Some(GamepadAxis::RightTrigger),
454 _ => None,
455 };
456 let Some(axis) = axis else {
457 return;
458 };
459 let Some(index) = self.assign_index_if_unique(gilrs, id) else {
460 return;
461 };
462 app.set_gamepad_axis(index, axis, value.clamp(0.0, 1.0));
463 }
464
465 fn assign_index_if_unique(&mut self, gilrs: &Gilrs, id: GamepadId) -> Option<usize> {

Callers 1

begin_frameMethod · 0.80

Calls 6

is_joyconFunction · 0.85
map_button_to_gilrsFunction · 0.85
extendMethod · 0.80
set_buttonMethod · 0.80
clearMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected