static private XInputSetState ( int dwUserIndex, |
||
dwUserIndex | int | The Index. |
pVibration | The Vibration. | |
return | int |
/// <summary> /// Updates the object. /// </summary> /// <param name="gameTime">The GameTime.</param> public void Update(GameTime gameTime) { int result = XInputInterops.XInputGetState(_playerIndex, ref _gamepadStateCurrent); IsAvailable = (result == 0); if (!IsAvailable) { return; } UpdateBatteryState(); _gamepadStatePrev.Copy(_gamepadStateCurrent); if (_vibrationTime > 0) { _vibrationTime -= gameTime.ElapsedGameTime; } if (_vibrationTime <= 0 && !_vibrationStopped) { var stopStrength = new XInputVibration { LeftMotorSpeed = 0, RightMotorSpeed = 0 }; XInputInterops.XInputSetState(_playerIndex, ref stopStrength); _vibrationStopped = true; } }
/// <summary> /// Vibrates the controller. /// </summary> /// <param name="strength">The Strength.</param> /// <param name="length">The Length.</param> internal void Vibrate(XInputVibration strength, float length) { XInputInterops.XInputSetState(_playerIndex, ref strength); _vibrationStopped = false; _vibrationTime = length; }