use xinput, invert y

This commit is contained in:
griffi-gh 2023-01-30 04:20:13 +01:00
parent 88b115732b
commit 00839d6b2e
2 changed files with 2 additions and 2 deletions

View file

@ -17,4 +17,4 @@ shipyard = { version = "0.6", features = ["thread_local"] }
nohash-hasher = "0.2.0" nohash-hasher = "0.2.0"
anyhow = "1.0" anyhow = "1.0"
flume = "0.10" flume = "0.10"
gilrs = "0.10" gilrs = { version = "0.10", default_features = false, features = ["xinput"] }

View file

@ -100,7 +100,7 @@ fn update_input_state_gamepad (
) { ) {
if let Some(Some(gamepad)) = active_gamepad.0.map(|id| gilrs.0.connected_gamepad(id)) { if let Some(Some(gamepad)) = active_gamepad.0.map(|id| gilrs.0.connected_gamepad(id)) {
let left_stick = vec2(gamepad.value(Axis::LeftStickX), gamepad.value(Axis::LeftStickY)); let left_stick = vec2(gamepad.value(Axis::LeftStickX), gamepad.value(Axis::LeftStickY));
let right_stick = vec2(gamepad.value(Axis::RightStickX), gamepad.value(Axis::RightStickY)); let right_stick = vec2(gamepad.value(Axis::RightStickX), -gamepad.value(Axis::RightStickY));
inputs.movement += left_stick; inputs.movement += left_stick;
inputs.look += right_stick; inputs.look += right_stick;
inputs.action_a |= gamepad.is_pressed(Button::South); inputs.action_a |= gamepad.is_pressed(Button::South);