Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix GamePadCapabilities #1565

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions src/Xna.Framework.Input/Input/GamePadCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ internal GamePadCapabilities(
bool hasLeftVibrationMotor, bool hasRightVibrationMotor,
bool hasVoiceSupport) : this()
{
bool hasLeftThumbstickLeft = (_hasButtons & Buttons.LeftThumbstickLeft) != Buttons.LeftThumbstickLeft;
bool hasLeftThumbstickRight = (_hasButtons & Buttons.LeftThumbstickRight) != Buttons.LeftThumbstickRight;
bool hasLeftThumbstickDown = (_hasButtons & Buttons.LeftThumbstickDown) != Buttons.LeftThumbstickDown;
bool hasLeftThumbstickUp = (_hasButtons & Buttons.LeftThumbstickUp) != Buttons.LeftThumbstickUp;
bool hasRightThumbstickLeft = (_hasButtons & Buttons.RightThumbstickLeft) != Buttons.RightThumbstickLeft;
bool hasRightThumbstickRight = (_hasButtons & Buttons.RightThumbstickRight) != Buttons.RightThumbstickRight;
bool hasRightThumbstickDown = (_hasButtons & Buttons.RightThumbstickDown) != Buttons.RightThumbstickDown;
bool hasRightThumbstickUp = (_hasButtons & Buttons.RightThumbstickUp) != Buttons.RightThumbstickUp;
bool hasLeftThumbstickLeft = (_hasButtons & Buttons.LeftThumbstickLeft) == Buttons.LeftThumbstickLeft;
bool hasLeftThumbstickRight = (_hasButtons & Buttons.LeftThumbstickRight) == Buttons.LeftThumbstickRight;
bool hasLeftThumbstickDown = (_hasButtons & Buttons.LeftThumbstickDown) == Buttons.LeftThumbstickDown;
bool hasLeftThumbstickUp = (_hasButtons & Buttons.LeftThumbstickUp) == Buttons.LeftThumbstickUp;
bool hasRightThumbstickLeft = (_hasButtons & Buttons.RightThumbstickLeft) == Buttons.RightThumbstickLeft;
bool hasRightThumbstickRight = (_hasButtons & Buttons.RightThumbstickRight) == Buttons.RightThumbstickRight;
bool hasRightThumbstickDown = (_hasButtons & Buttons.RightThumbstickDown) == Buttons.RightThumbstickDown;
bool hasRightThumbstickUp = (_hasButtons & Buttons.RightThumbstickUp) == Buttons.RightThumbstickUp;
Debug.Assert(hasLeftThumbstickLeft == hasLeftThumbstickRight); // ButtonLeftXThumbStick
Debug.Assert(hasLeftThumbstickDown == hasLeftThumbstickUp); // ButtonLeftYThumbStick
Debug.Assert(hasRightThumbstickLeft == hasRightThumbstickRight); // ButtonRightXThumbStick
Expand All @@ -107,7 +107,7 @@ internal GamePadCapabilities(
/// <value><c>true</c> if it is connected; otherwise, <c>false</c>.</value>
public bool IsConnected
{
get { return (_hasCaps & CapsConnected) != CapsConnected; }
get { return (_hasCaps & CapsConnected) == CapsConnected; }
internal set
{
_hasCaps = (value)
Expand Down Expand Up @@ -138,7 +138,7 @@ internal set
/// <value><c>true</c> if it has the button A; otherwise, <c>false</c>.</value>
public bool HasAButton
{
get { return (_hasButtons & Buttons.A) != Buttons.A; }
get { return (_hasButtons & Buttons.A) == Buttons.A; }
internal set
{
_hasButtons = (value)
Expand All @@ -153,7 +153,7 @@ internal set
/// <value><c>true</c> if it has the button Back; otherwise, <c>false</c>.</value>
public bool HasBackButton
{
get { return (_hasButtons & Buttons.Back) != Buttons.Back; }
get { return (_hasButtons & Buttons.Back) == Buttons.Back; }
internal set
{
_hasButtons = (value)
Expand All @@ -168,7 +168,7 @@ internal set
/// <value><c>true</c> if it has the button B; otherwise, <c>false</c>.</value>
public bool HasBButton
{
get { return (_hasButtons & Buttons.B) != Buttons.B; }
get { return (_hasButtons & Buttons.B) == Buttons.B; }
internal set
{
_hasButtons = (value)
Expand All @@ -183,7 +183,7 @@ internal set
/// <value><c>true</c> if it has the directional pad down button; otherwise, <c>false</c>.</value>
public bool HasDPadDownButton
{
get { return (_hasButtons & Buttons.DPadDown) != Buttons.DPadDown; }
get { return (_hasButtons & Buttons.DPadDown) == Buttons.DPadDown; }
internal set
{
_hasButtons = (value)
Expand All @@ -198,7 +198,7 @@ internal set
/// <value><c>true</c> if it has the directional pad left button; otherwise, <c>false</c>.</value>
public bool HasDPadLeftButton
{
get { return (_hasButtons & Buttons.DPadLeft) != Buttons.DPadLeft; }
get { return (_hasButtons & Buttons.DPadLeft) == Buttons.DPadLeft; }
internal set
{
_hasButtons = (value)
Expand All @@ -213,7 +213,7 @@ internal set
/// <value><c>true</c> if it has the directional pad right button; otherwise, <c>false</c>.</value>
public bool HasDPadRightButton
{
get { return (_hasButtons & Buttons.DPadRight) != Buttons.DPadRight; }
get { return (_hasButtons & Buttons.DPadRight) == Buttons.DPadRight; }
internal set
{
_hasButtons = (value)
Expand All @@ -228,7 +228,7 @@ internal set
/// <value><c>true</c> if it has the directional pad up button; otherwise, <c>false</c>.</value>
public bool HasDPadUpButton
{
get { return (_hasButtons & Buttons.DPadUp) != Buttons.DPadUp; }
get { return (_hasButtons & Buttons.DPadUp) == Buttons.DPadUp; }
internal set
{
_hasButtons = (value)
Expand All @@ -243,7 +243,7 @@ internal set
/// <value><c>true</c> if it has the left shoulder button; otherwise, <c>false</c>.</value>
public bool HasLeftShoulderButton
{
get { return (_hasButtons & Buttons.LeftShoulder) != Buttons.LeftShoulder; }
get { return (_hasButtons & Buttons.LeftShoulder) == Buttons.LeftShoulder; }
internal set
{
_hasButtons = (value)
Expand All @@ -258,7 +258,7 @@ internal set
/// <value><c>true</c> if it has the left stick button; otherwise, <c>false</c>.</value>
public bool HasLeftStickButton
{
get { return (_hasButtons & Buttons.LeftStick) != Buttons.LeftStick; }
get { return (_hasButtons & Buttons.LeftStick) == Buttons.LeftStick; }
internal set
{
_hasButtons = (value)
Expand All @@ -273,7 +273,7 @@ internal set
/// <value><c>true</c> if it has the right shoulder button; otherwise, <c>false</c>.</value>
public bool HasRightShoulderButton
{
get { return (_hasButtons & Buttons.RightShoulder) != Buttons.RightShoulder; }
get { return (_hasButtons & Buttons.RightShoulder) == Buttons.RightShoulder; }
internal set
{
_hasButtons = (value)
Expand All @@ -288,7 +288,7 @@ internal set
/// <value><c>true</c> if it has the right stick button; otherwise, <c>false</c>.</value>
public bool HasRightStickButton
{
get { return (_hasButtons & Buttons.RightStick) != Buttons.RightStick; }
get { return (_hasButtons & Buttons.RightStick) == Buttons.RightStick; }
internal set
{
_hasButtons = (value)
Expand All @@ -303,7 +303,7 @@ internal set
/// <value><c>true</c> if it has the button Start; otherwise, <c>false</c>.</value>
public bool HasStartButton
{
get { return (_hasButtons & Buttons.Start) != Buttons.Start; }
get { return (_hasButtons & Buttons.Start) == Buttons.Start; }
internal set
{
_hasButtons = (value)
Expand All @@ -318,7 +318,7 @@ internal set
/// <value><c>true</c> if it has the button X; otherwise, <c>false</c>.</value>
public bool HasXButton
{
get { return (_hasButtons & Buttons.X) != Buttons.X; }
get { return (_hasButtons & Buttons.X) == Buttons.X; }
internal set
{
_hasButtons = (value)
Expand All @@ -333,7 +333,7 @@ internal set
/// <value><c>true</c> if it has the button Y; otherwise, <c>false</c>.</value>
public bool HasYButton
{
get { return (_hasButtons & Buttons.Y) != Buttons.Y; }
get { return (_hasButtons & Buttons.Y) == Buttons.Y; }
internal set
{
_hasButtons = (value)
Expand All @@ -348,7 +348,7 @@ internal set
/// <value><c>true</c> if it has the guide button; otherwise, <c>false</c>.</value>
public bool HasBigButton
{
get { return (_hasButtons & Buttons.BigButton) != Buttons.BigButton; }
get { return (_hasButtons & Buttons.BigButton) == Buttons.BigButton; }
internal set
{
_hasButtons = (value)
Expand All @@ -363,7 +363,7 @@ internal set
/// <value><c>true</c> if it has X axis for the left stick (thumbstick) button; otherwise, <c>false</c>.</value>
public bool HasLeftXThumbStick
{
get { return (_hasButtons & ButtonLeftXThumbStick) != ButtonLeftXThumbStick; }
get { return (_hasButtons & ButtonLeftXThumbStick) == ButtonLeftXThumbStick; }
internal set
{
_hasButtons = (value)
Expand All @@ -378,7 +378,7 @@ internal set
/// <value><c>true</c> if it has Y axis for the left stick (thumbstick) button; otherwise, <c>false</c>.</value>
public bool HasLeftYThumbStick
{
get { return (_hasButtons & ButtonLeftYThumbStick) != ButtonLeftYThumbStick; }
get { return (_hasButtons & ButtonLeftYThumbStick) == ButtonLeftYThumbStick; }
internal set
{
_hasButtons = (value)
Expand All @@ -393,7 +393,7 @@ internal set
/// <value><c>true</c> if it has X axis for the right stick (thumbstick) button; otherwise, <c>false</c>.</value>
public bool HasRightXThumbStick
{
get { return (_hasButtons & ButtonRightXThumbStick) != ButtonRightXThumbStick; }
get { return (_hasButtons & ButtonRightXThumbStick) == ButtonRightXThumbStick; }
internal set
{
_hasButtons = (value)
Expand All @@ -408,7 +408,7 @@ internal set
/// <value><c>true</c> if it has Y axis for the right stick (thumbstick) button; otherwise, <c>false</c>.</value>
public bool HasRightYThumbStick
{
get { return (_hasButtons & ButtonRightYThumbStick) != ButtonRightYThumbStick; }
get { return (_hasButtons & ButtonRightYThumbStick) == ButtonRightYThumbStick; }
internal set
{
_hasButtons = (value)
Expand All @@ -423,7 +423,7 @@ internal set
/// <value><c>true</c> if it has the left trigger button; otherwise, <c>false</c>.</value>
public bool HasLeftTrigger
{
get { return (_hasButtons & Buttons.LeftTrigger) != Buttons.LeftTrigger; }
get { return (_hasButtons & Buttons.LeftTrigger) == Buttons.LeftTrigger; }
internal set
{
_hasButtons = (value)
Expand All @@ -438,7 +438,7 @@ internal set
/// <value><c>true</c> if it has the right trigger button; otherwise, <c>false</c>.</value>
public bool HasRightTrigger
{
get { return (_hasButtons & Buttons.RightTrigger) != Buttons.RightTrigger; }
get { return (_hasButtons & Buttons.RightTrigger) == Buttons.RightTrigger; }
internal set
{
_hasButtons = (value)
Expand All @@ -453,7 +453,7 @@ internal set
/// <value><c>true</c> if it has the left vibration motor; otherwise, <c>false</c>.</value>
public bool HasLeftVibrationMotor
{
get { return (_hasCaps & CapsLeftVibrationMotor) != CapsLeftVibrationMotor; }
get { return (_hasCaps & CapsLeftVibrationMotor) == CapsLeftVibrationMotor; }
internal set
{
_hasCaps = (value)
Expand All @@ -468,7 +468,7 @@ internal set
/// <value><c>true</c> if it has the right vibration motor; otherwise, <c>false</c>.</value>
public bool HasRightVibrationMotor
{
get { return (_hasCaps & CapsRightVibrationMotor) != CapsRightVibrationMotor; }
get { return (_hasCaps & CapsRightVibrationMotor) == CapsRightVibrationMotor; }
internal set
{
_hasCaps = (value)
Expand All @@ -483,7 +483,7 @@ internal set
/// <value><c>true</c> if it has a microphone; otherwise, <c>false</c>.</value>
public bool HasVoiceSupport
{
get { return (_hasCaps & CapsVoiceSupport) != CapsVoiceSupport; }
get { return (_hasCaps & CapsVoiceSupport) == CapsVoiceSupport; }
internal set
{
_hasCaps = (value)
Expand Down
Loading