Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    GameControllerDeviceBase Class

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

    Base class for gamepads, contains common functionality for gamepad devices

    System.Object → GameControllerDeviceBase
    Derived from GameControllerDeviceBase:

    public abstract class GameControllerDeviceBase : IGameControllerDevice, IInputDevice
    Name Description
    Constructors
    GameControllerDeviceBase()
    Fields
    AxisStates
    ButtonStates
    DirectionStates
    Properties
    AxisInfos
    ButtonInfos
    DirectionInfos
    DownButtons
    Id
    Name
    PressedButtons
    Priority
    ProductId
    ReleasedButtons
    Source
    Methods
    GetAxis(Int32)
    GetDirection(Int32)
    HandleAxis(Int32, Single)
    HandleButton(Int32, Boolean)
    HandleDirection(Int32, Direction)
    InitializeButtonStates()

    Creates the correct amount of states based on the amount of object infos that are set

    Update(List<InputEvent>)

    Raise gamepad events collected by Handle... functions

    | Improve this Doc View Source

    Constructors


    GameControllerDeviceBase()

    protected GameControllerDeviceBase()
    | Improve this Doc View Source

    Fields


    AxisStates

    protected float[] AxisStates
    Field Value
    Type Description
    System.Single[]

    ButtonStates

    protected bool[] ButtonStates
    Field Value
    Type Description
    System.Boolean[]

    DirectionStates

    protected Direction[] DirectionStates
    Field Value
    Type Description
    Direction[]
    | Improve this Doc View Source

    Properties


    AxisInfos

    public abstract IReadOnlyList<GameControllerAxisInfo> AxisInfos { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyList<GameControllerAxisInfo>

    ButtonInfos

    public abstract IReadOnlyList<GameControllerButtonInfo> ButtonInfos { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyList<GameControllerButtonInfo>

    DirectionInfos

    public abstract IReadOnlyList<GameControllerDirectionInfo> DirectionInfos { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyList<GameControllerDirectionInfo>

    DownButtons

    public IReadOnlySet<int> DownButtons { get; }
    Property Value
    Type Description
    IReadOnlySet<System.Int32>

    Id

    public abstract Guid Id { get; }
    Property Value
    Type Description
    System.Guid

    Name

    public abstract string Name { get; }
    Property Value
    Type Description
    System.String

    PressedButtons

    public IReadOnlySet<int> PressedButtons { get; }
    Property Value
    Type Description
    IReadOnlySet<System.Int32>

    Priority

    public int Priority { get; set; }
    Property Value
    Type Description
    System.Int32

    ProductId

    public virtual Guid ProductId { get; }
    Property Value
    Type Description
    System.Guid

    ReleasedButtons

    public IReadOnlySet<int> ReleasedButtons { get; }
    Property Value
    Type Description
    IReadOnlySet<System.Int32>

    Source

    public abstract IInputSource Source { get; }
    Property Value
    Type Description
    IInputSource
    | Improve this Doc View Source

    Methods


    GetAxis(Int32)

    public virtual float GetAxis(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    System.Single

    GetDirection(Int32)

    public virtual Direction GetDirection(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    Direction

    HandleAxis(Int32, Single)

    protected void HandleAxis(int index, float state)
    Parameters
    Type Name Description
    System.Int32 index
    System.Single state

    HandleButton(Int32, Boolean)

    protected void HandleButton(int index, bool state)
    Parameters
    Type Name Description
    System.Int32 index
    System.Boolean state

    HandleDirection(Int32, Direction)

    protected void HandleDirection(int index, Direction state)
    Parameters
    Type Name Description
    System.Int32 index
    Direction state

    InitializeButtonStates()

    Creates the correct amount of states based on the amount of object infos that are set

    protected void InitializeButtonStates()

    Update(List<InputEvent>)

    Raise gamepad events collected by Handle... functions

    public virtual void Update(List<InputEvent> inputEvents)
    Parameters
    Type Name Description
    System.Collections.Generic.List<InputEvent> inputEvents

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    GameControllerExtensions.GetButtonCount(IGameControllerDevice)
    GameControllerExtensions.GetAxisCount(IGameControllerDevice)
    GameControllerExtensions.GetDirectionCount(IGameControllerDevice)
    GameControllerExtensions.GetDPad(IGameControllerDevice, Int32)
    GameControllerDeviceExtensions.IsButtonPressed(IGameControllerDevice, Int32)
    GameControllerDeviceExtensions.IsButtonReleased(IGameControllerDevice, Int32)
    GameControllerDeviceExtensions.IsButtonDown(IGameControllerDevice, Int32)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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