public float GetValue(NanoGamepadAxis axis) { switch (axis) { case NanoGamepadAxis.LeftX: return(LeftThumbX); case NanoGamepadAxis.LeftY: return(LeftThumbY); case NanoGamepadAxis.RightX: return(RightThumbX); case NanoGamepadAxis.RightY: return(RightThumbY); case NanoGamepadAxis.TriggerLeft: return(LeftTrigger); case NanoGamepadAxis.TriggerRight: return(RightTrigger); default: throw new NotSupportedException(); } }
public void SetValue(NanoGamepadAxis axis, float value) { switch (axis) { case NanoGamepadAxis.LeftX: LeftThumbX = (ushort)value; break; case NanoGamepadAxis.LeftY: LeftThumbY = (ushort)value; break; case NanoGamepadAxis.RightX: RightThumbX = (ushort)value; break; case NanoGamepadAxis.RightY: RightThumbY = (ushort)value; break; case NanoGamepadAxis.TriggerLeft: LeftTrigger = (byte)((value / 32768) * 0xFF); break; case NanoGamepadAxis.TriggerRight: RightTrigger = (byte)((value / 32768) * 0xFF); break; default: throw new NotSupportedException(); } }
private void HandleControllerAxisChange(NanoGamepadAxis axis, float axisValue) { Analog.SetValue(axis, axisValue); }