Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    VirtualButton Class

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

    Describes a virtual button (a key from a keyboard, a mouse button, an axis of a joystick...etc.).

    System.Object → VirtualButton
    Derived from VirtualButton: VirtualButton.GamePad VirtualButton.Keyboard VirtualButton.Mouse VirtualButton.Pointer

    public abstract class VirtualButton : IVirtualButton
    Name Description
    Constructors
    VirtualButton(String, VirtualButtonType, Int32, Boolean)

    Initializes a new instance of the VirtualButton class.

    Fields
    Id

    Unique Id for a particular button Type.

    Index
    IsPositiveAndNegative

    A boolean indicating whether this button supports positive and negative value.

    ShortName

    The short name of this button.

    Type

    Type of this button.

    Properties
    Name

    The full name of this button.

    Registered

    Gets all registered VirtualButton.

    Methods
    BuildButtonName()
    Find(Int32)

    Finds a virtual button by the specified id.

    Find(String)

    Finds a virtual button by the specified name.

    GetValue(InputManager)
    IsDown(InputManager)
    IsPressed(InputManager)
    IsReleased(InputManager)
    ToString()
    Operators
    Addition(IVirtualButton, VirtualButton)

    Implements the + operator to combine to VirtualButton.

    | Improve this Doc View Source

    Constructors


    VirtualButton(String, VirtualButtonType, Int32, Boolean)

    Initializes a new instance of the VirtualButton class.

    protected VirtualButton(string shortName, VirtualButtonType type, int id, bool isPositiveAndNegative = false)
    Parameters
    Type Name Description
    System.String shortName

    The name.

    VirtualButtonType type

    The type.

    System.Int32 id

    The id.

    System.Boolean isPositiveAndNegative

    if set to true [is positive and negative].

    | Improve this Doc View Source

    Fields


    Id

    Unique Id for a particular button Type.

    public readonly int Id
    Field Value
    Type Description
    System.Int32

    Index

    protected readonly int Index
    Field Value
    Type Description
    System.Int32

    IsPositiveAndNegative

    A boolean indicating whether this button supports positive and negative value.

    public readonly bool IsPositiveAndNegative
    Field Value
    Type Description
    System.Boolean

    ShortName

    The short name of this button.

    public readonly string ShortName
    Field Value
    Type Description
    System.String

    Type

    Type of this button.

    public readonly VirtualButtonType Type
    Field Value
    Type Description
    VirtualButtonType
    | Improve this Doc View Source

    Properties


    Name

    The full name of this button.

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

    Registered

    Gets all registered VirtualButton.

    public static IReadOnlyCollection<VirtualButton> Registered { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyCollection<VirtualButton>

    The registered virtual buttons.

    | Improve this Doc View Source

    Methods


    BuildButtonName()

    protected virtual string BuildButtonName()
    Returns
    Type Description
    System.String

    Find(Int32)

    Finds a virtual button by the specified id.

    public static VirtualButton Find(int id)
    Parameters
    Type Name Description
    System.Int32 id

    The id.

    Returns
    Type Description
    VirtualButton

    An instance of VirtualButton or null if no match.


    Find(String)

    Finds a virtual button by the specified name.

    public static VirtualButton Find(string name)
    Parameters
    Type Name Description
    System.String name

    The name.

    Returns
    Type Description
    VirtualButton

    An instance of VirtualButton or null if no match.


    GetValue(InputManager)

    public abstract float GetValue(InputManager manager)
    Parameters
    Type Name Description
    InputManager manager
    Returns
    Type Description
    System.Single

    IsDown(InputManager)

    public abstract bool IsDown(InputManager manager)
    Parameters
    Type Name Description
    InputManager manager
    Returns
    Type Description
    System.Boolean

    IsPressed(InputManager)

    public abstract bool IsPressed(InputManager manager)
    Parameters
    Type Name Description
    InputManager manager
    Returns
    Type Description
    System.Boolean

    IsReleased(InputManager)

    public abstract bool IsReleased(InputManager manager)
    Parameters
    Type Name Description
    InputManager manager
    Returns
    Type Description
    System.Boolean

    ToString()

    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()
    | Improve this Doc View Source

    Operators


    Addition(IVirtualButton, VirtualButton)

    Implements the + operator to combine to VirtualButton.

    public static IVirtualButton operator +(IVirtualButton left, VirtualButton right)
    Parameters
    Type Name Description
    IVirtualButton left

    The left virtual button.

    VirtualButton right

    The right virtual button.

    Returns
    Type Description
    IVirtualButton

    A set containting the two virtual buttons.


    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