/// <summary> /// Gets the keystroke. /// </summary> /// <param name="deviceQueryType">The flag.</param> /// <param name="keystroke">The keystroke.</param> /// <returns></returns> /// <unmanaged>unsigned int XInputGetKeystroke([In] XUSER_INDEX dwUserIndex,[In] unsigned int dwReserved,[Out] XINPUT_KEYSTROKE* pKeystroke)</unmanaged> public Result GetKeystroke(DeviceQueryType deviceQueryType, out Keystroke keystroke) { var result = ErrorCodeHelper.ToResult(xinput.XInputGetKeystroke((int)userIndex, (int)deviceQueryType, out keystroke)); result.CheckError(); return(result); }
/// <summary>Gets the keystroke.</summary> /// <param name="deviceQueryType">The flag.</param> /// <param name="keystroke">The keystroke.</param> /// <returns></returns> /// <unmanaged>unsigned int XInputGetKeystroke([In] XUSER_INDEX dwUserIndex,[In] unsigned int dwReserved,[Out] XINPUT_KEYSTROKE* pKeystroke)</unmanaged> public Result GetKeystroke(DeviceQueryType deviceQueryType, out Keystroke keystroke) { return(ErrorCodeHelper.ToResult(xinput.XInputGetKeystroke((int)this.userIndex, (int)deviceQueryType, out keystroke))); }
/// <summary> /// Retrieves a gamepad input event. /// </summary> /// <param name="userIndex">Index of the user's controller. Can be a value in the range 0–3. </param> /// <param name="keystroke">The keystroke.</param> /// <returns>False if the controller is not connected and no new keys have been pressed, true otherwise.</returns> public static bool GetKeystroke(int userIndex, out Keystroke keystroke) { return(s_xInput.XInputGetKeystroke(userIndex, out keystroke) == 0); }