Struct GamePadState
Describes the state of a typical gamepad.
public readonly struct GamePadState : IEquatable<GamePadState>, IEqualityOperators<GamePadState, GamePadState, bool>
- Implements
- Inherited Members
- Extension Methods
Remarks
You can see the API docs of this struct on Official Stride3D website.
Constructors
GamePadState(GamePadButtons, Vector2, Vector2, float, float)
Initializes a new instance of the GamePadState struct.
public GamePadState(GamePadButtons buttons, Vector2 leftThumb, Vector2 rightThumb, float leftTrigger, float rightTrigger)
Parameters
buttonsGamePadButtonsSet of pressed buttons.
leftThumbVector2Position of the left thumb.
rightThumbVector2Position of the right thumb.
leftTriggerfloatValue of the left trigger.
rightTriggerfloatValue of the right trigger.
Fields
Buttons
Bitmask of the gamepad buttons.
public readonly GamePadButtons Buttons
Field Value
LeftThumb
Left thumbstick x-axis/y-axis value. The value is in the range [-1.0f, 1.0f] for both axis.
public readonly Vector2 LeftThumb
Field Value
LeftTrigger
The left trigger analog control in the range [0, 1.0f]. See remarks.
public readonly float LeftTrigger
Field Value
Remarks
Some controllers are not supporting the range of value and may act as a simple button returning only 0 or 1.
RightThumb
Right thumbstick x-axis/y-axis value. The value is in the range [-1.0f, 1.0f] for both axis.
public readonly Vector2 RightThumb
Field Value
RightTrigger
The right trigger analog control in the range [0, 1.0f]. See remarks.
public readonly float RightTrigger
Field Value
Remarks
Some controllers are not supporting the range of value and may act as a simple button returning only 0 or 1.
Methods
Equals(GamePadState)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(GamePadState other)
Parameters
otherGamePadStateAn object to compare with this object.
Returns
- bool
true if the current object is equal to the
otherparameter; otherwise, false.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Operators
operator ==(GamePadState, GamePadState)
Compares two values to determine equality.
public static bool operator ==(GamePadState left, GamePadState right)
Parameters
leftGamePadStateThe value to compare with
right.rightGamePadStateThe value to compare with
left.
Returns
operator !=(GamePadState, GamePadState)
Compares two values to determine inequality.
public static bool operator !=(GamePadState left, GamePadState right)
Parameters
leftGamePadStateThe value to compare with
right.rightGamePadStateThe value to compare with
left.