public XInputState GetControllerState(uint controllerId) { var result = new XInputState(); var opResult = XInputInvoker.XInputGetState(controllerId, ref result); switch (opResult) { case XInputOpResult.Success: return(result); case XInputOpResult.Error_DeviceNotConnected: throw new TurboXInputException(TurboXInputExceptionCode.DeviceNotConnected); default: throw new TurboXInputException(TurboXInputExceptionCode.UnexpectedError, "Error Code: " + opResult.ToString()); } }
public static extern XInputOpResult XInputGetState(uint dwUserIndex, ref XInputState pState);