reaction 0.2.0

Universal low-latency input handling for game engines
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
pub enum SensitivityCurve {
    Linear,
    Exponential(f32), // Power
}

pub fn apply_sensitivity(value: f32, sensitivity: f32, curve: SensitivityCurve) -> f32 {
    let scaled = value * sensitivity;
    match curve {
        SensitivityCurve::Linear => scaled,
        SensitivityCurve::Exponential(exponent) => scaled.signum() * scaled.abs().powf(exponent),
    }
}