Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    GamePadState Struct

    Namespace: Stride.Input
    Assembly: Stride.Input.dll

    Describes the state of a typical gamepad.

    public struct GamePadState : IEquatable<GamePadState>
    Name Description
    Fields
    Buttons

    Bitmask of the gamepad buttons.

    LeftThumb

    Left thumbstick x-axis/y-axis value. The value is in the range [-1.0f, 1.0f] for both axis.

    LeftTrigger

    The left trigger analog control in the range [0, 1.0f]. See remarks.

    RightThumb

    Right thumbstick x-axis/y-axis value. The value is in the range [-1.0f, 1.0f] for both axis.

    RightTrigger

    The right trigger analog control in the range [0, 1.0f]. See remarks.

    Methods
    Equals(GamePadState)

    Indicates whether the current object is equal to another object of the same type.

    Equals(Object)
    GetHashCode()
    ToString()
    Update(GamePadAxisEvent)

    Updates the state from any gamepad events received that have mapped buttons

    Update(GamePadButtonEvent)

    Updates the state from any gamepad events received that have mapped buttons

    Update(InputEvent)

    Updates the state from any gamepad events received that have mapped buttons

    Operators
    Equality(GamePadState, GamePadState)

    Implements the == operator.

    Inequality(GamePadState, GamePadState)

    Implements the != operator.

    | Improve this Doc View Source

    Fields


    Buttons

    Bitmask of the gamepad buttons.

    public GamePadButton Buttons
    Field Value
    Type Description
    GamePadButton

    LeftThumb

    Left thumbstick x-axis/y-axis value. The value is in the range [-1.0f, 1.0f] for both axis.

    public Vector2 LeftThumb
    Field Value
    Type Description
    Vector2

    LeftTrigger

    The left trigger analog control in the range [0, 1.0f]. See remarks.

    public float LeftTrigger
    Field Value
    Type Description
    System.Single
    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 Vector2 RightThumb
    Field Value
    Type Description
    Vector2

    RightTrigger

    The right trigger analog control in the range [0, 1.0f]. See remarks.

    public float RightTrigger
    Field Value
    Type Description
    System.Single
    Remarks

    Some controllers are not supporting the range of value and may act as a simple button returning only 0 or 1.

    | Improve this Doc View Source

    Methods


    Equals(GamePadState)

    Indicates whether the current object is equal to another object of the same type.

    public bool Equals(GamePadState other)
    Parameters
    Type Name Description
    GamePadState other

    An object to compare with this object.

    Returns
    Type Description
    System.Boolean

    true if the current object is equal to the other parameter; otherwise, false.


    Equals(Object)

    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.ValueType.GetHashCode()

    ToString()

    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()

    Update(GamePadAxisEvent)

    Updates the state from any gamepad events received that have mapped buttons

    public bool Update(GamePadAxisEvent axisEvent)
    Parameters
    Type Name Description
    GamePadAxisEvent axisEvent

    The gamepad event to process

    Returns
    Type Description
    System.Boolean

    true if the event made any changes


    Update(GamePadButtonEvent)

    Updates the state from any gamepad events received that have mapped buttons

    public bool Update(GamePadButtonEvent buttonEvent)
    Parameters
    Type Name Description
    GamePadButtonEvent buttonEvent

    The gamepad event to process

    Returns
    Type Description
    System.Boolean

    true if the event made any changes


    Update(InputEvent)

    Updates the state from any gamepad events received that have mapped buttons

    public bool Update(InputEvent evt)
    Parameters
    Type Name Description
    InputEvent evt

    The gamepad event to process

    Returns
    Type Description
    System.Boolean

    true if the event made any changes

    | Improve this Doc View Source

    Operators


    Equality(GamePadState, GamePadState)

    Implements the == operator.

    public static bool operator ==(GamePadState left, GamePadState right)
    Parameters
    Type Name Description
    GamePadState left

    The left gamepad value.

    GamePadState right

    The right gamepad value.

    Returns
    Type Description
    System.Boolean

    The result of the operator.


    Inequality(GamePadState, GamePadState)

    Implements the != operator.

    public static bool operator !=(GamePadState left, GamePadState right)
    Parameters
    Type Name Description
    GamePadState left

    The left gamepad value.

    GamePadState right

    The right gamepad value.

    Returns
    Type Description
    System.Boolean

    The result of the operator.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)

    See Also

    State
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation