Skip to main content

stick_axis

Function stick_axis 

Source
pub fn stick_axis(value: i32, minimum: i32, maximum: i32) -> f32
Expand description

A stick axis from its input_absinfo range to −1…1, before any Y flip.

The centre is the range’s midpoint rounded up, and one scale serves both halves — the distance from the centre to maximum — with the value clamped to −1…1. That is xinput::stick_axis’s rule generalised: on xpad’s −32768…32767 the centre is 0, 32767 reads 1 and the spare −32768 clamps to −1, and a push of n codes reads the same distance either way. A range with no extent (maximum <= minimum) reads 0.

flat is not applied: the seam’s axes are raw (gamepad.rs), so the dead zone is the binding’s.