Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    GamePadLayout Class

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

    Provides a IGameControllerDevice to IGamePadDevice mapping

    System.Object → GamePadLayout
    Derived from GamePadLayout: GamePadLayoutDS4 GamePadLayoutXInput

    public abstract class GamePadLayout
    Name Description
    Fields
    mapFirstPovToPad

    Should direction controller 0 be mapped to the directional pad?

    Methods
    AddAxisToAxis(Int32, GamePadAxis, Boolean, Boolean)

    Adds a mapping from an axis index to GamePadAxis

    AddAxisToButton(Int32, GamePadButton)

    Adds a mapping from an axis index to GamePadButton

    AddButtonToAxis(Int32, GamePadAxis, Boolean)

    Adds a mapping from a button index to GamePadAxis

    AddButtonToButton(Int32, GamePadButton)

    Adds a mapping from a button index to GamePadButton

    CompareProductId(Guid, Guid, Int32, Int32)

    Compares a product id

    InitializeDevice(IGamePadDevice, IGameControllerDevice)

    Allows the user to perform some additional setup operations when using this layout on a device

    MapInputEvent(IGamePadDevice, IGameControllerDevice, InputEvent, List<InputEvent>)

    Maps game controller events to gamepad events

    MatchDevice(IInputSource, IGameControllerDevice)

    Checks if a device matches this gamepad layout, and thus should use this when mapping it to a GamePadState

    | Improve this Doc View Source

    Fields


    mapFirstPovToPad

    Should direction controller 0 be mapped to the directional pad?

    protected bool mapFirstPovToPad
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Methods


    AddAxisToAxis(Int32, GamePadAxis, Boolean, Boolean)

    Adds a mapping from an axis index to GamePadAxis

    protected void AddAxisToAxis(int index, GamePadAxis axis, bool invert = false, bool remap = false)
    Parameters
    Type Name Description
    System.Int32 index

    The axis index of the axis on this device

    GamePadAxis axis

    The axis to map to

    System.Boolean invert

    Should axis be inverted

    System.Boolean remap

    Remap this axis from (-1,1) to (0,1)


    AddAxisToButton(Int32, GamePadButton)

    Adds a mapping from an axis index to GamePadButton

    protected void AddAxisToButton(int index, GamePadButton button)
    Parameters
    Type Name Description
    System.Int32 index

    The axis index of the axis on this device

    GamePadButton button

    The button(s) to map to


    AddButtonToAxis(Int32, GamePadAxis, Boolean)

    Adds a mapping from a button index to GamePadAxis

    protected void AddButtonToAxis(int index, GamePadAxis axis, bool invert = false)
    Parameters
    Type Name Description
    System.Int32 index

    The button index of the button on this device

    GamePadAxis axis

    The axi to map to

    System.Boolean invert

    Should axis be inverted, output -1 instead of 1 on press


    AddButtonToButton(Int32, GamePadButton)

    Adds a mapping from a button index to GamePadButton

    protected void AddButtonToButton(int index, GamePadButton button)
    Parameters
    Type Name Description
    System.Int32 index

    The button index of the button on this device

    GamePadButton button

    The button(s) to map to


    CompareProductId(Guid, Guid, Int32, Int32)

    Compares a product id

    public static bool CompareProductId(Guid a, Guid b, int numBytes = 16, int byteOffset = 0)
    Parameters
    Type Name Description
    System.Guid a

    id a

    System.Guid b

    id b

    System.Int32 numBytes

    number of bytes to compare, starting from byteOffset

    System.Int32 byteOffset

    starting byte index from where to compare

    Returns
    Type Description
    System.Boolean

    InitializeDevice(IGamePadDevice, IGameControllerDevice)

    Allows the user to perform some additional setup operations when using this layout on a device

    public virtual void InitializeDevice(IGamePadDevice targetDevice, IGameControllerDevice sourceDevice)
    Parameters
    Type Name Description
    IGamePadDevice targetDevice

    The gamepad that events are mapped to

    IGameControllerDevice sourceDevice

    The game controller that is mapped to a gamepad


    MapInputEvent(IGamePadDevice, IGameControllerDevice, InputEvent, List<InputEvent>)

    Maps game controller events to gamepad events

    public virtual void MapInputEvent(IGamePadDevice targetDevice, IGameControllerDevice sourceDevice, InputEvent controllerEvent, List<InputEvent> target)
    Parameters
    Type Name Description
    IGamePadDevice targetDevice

    The gamepad that events are mapped to

    IGameControllerDevice sourceDevice

    The game controller that is mapped to a gamepad

    InputEvent controllerEvent

    The controller input event as a source

    System.Collections.Generic.List<InputEvent> target

    Target list


    MatchDevice(IInputSource, IGameControllerDevice)

    Checks if a device matches this gamepad layout, and thus should use this when mapping it to a GamePadState

    public abstract bool MatchDevice(IInputSource source, IGameControllerDevice device)
    Parameters
    Type Name Description
    IInputSource source

    Source that this device comes from

    IGameControllerDevice device

    The device to match

    Returns
    Type Description
    System.Boolean

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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