public void UpdateRawState(osuTK.Input.JoystickState rawState) { LastRawState = RawState; RawState = rawState; if (!defaultDeadZones.IsValueCreated) { for (int i = 0; i < MAX_AXES; i++) { // Cap deadzone at 0.5f to avoid division by zero and catastrophic cancellation when rescaling defaultDeadZones.Value[i] = Math.Min(0.5f, Math.Abs(RawState.GetAxis(i)) + deadzone_threshold); } } }
public void UpdateRawState(osuTK.Input.JoystickState rawState) { LastRawState = RawState; RawState = rawState; if (!defaultDeadZones.IsValueCreated) { for (int i = 0; i < MAX_AXES; i++) { var axisValue = Math.Abs(RawState.GetAxis(i)); if (Precision.AlmostEquals(0, axisValue)) { continue; } defaultDeadZones.Value[i] = axisValue + deadzone_threshold; } } }