/// <summary> /// Sets the state of the XboxGamepad. /// </summary> /// <param name="state">The state to set the XboxGamepad to.</param> public void SetXboxGamepadState(XboxGamepadState state) { if (state == null) { throw new ArgumentNullException("state"); } this.ThrowIfNotConnected(); this.Console.Adapter.SendGamepadReport(this.Console.SystemIpAddressAndSessionKeyCombined, this.Id.Value, state); }
/// <summary> /// Determines whether the two GamepadStates are equal. /// </summary> /// <param name="obj">Object to compare to.</param> /// <returns>True if states are the same, otherwise false.</returns> public override bool Equals(object obj) { XboxGamepadState other = obj as XboxGamepadState; if (other != null) { return (this.Buttons == other.Buttons && FloatEquals(other.LeftThumbstickX, this.LeftThumbstickX) && FloatEquals(other.LeftThumbstickY, this.LeftThumbstickY) && FloatEquals(other.LeftTrigger, this.LeftTrigger) && FloatEquals(other.RightThumbstickX, this.RightThumbstickX) && FloatEquals(other.RightThumbstickY, this.RightThumbstickY) && FloatEquals(other.RightTrigger, this.RightTrigger)); } return(false); }