Table of Contents

Class VirtualButton

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.).

public abstract class VirtualButton : IVirtualButton
Inheritance
VirtualButton
Implements
Derived

Constructors

VirtualButton(string, VirtualButtonType, int, bool)

Initializes a new instance of the VirtualButton class.

protected VirtualButton(string shortName, VirtualButtonType type, int id, bool isPositiveAndNegative = false)

Parameters

shortName string

The name.

type VirtualButtonType

The type.

id int

The id.

isPositiveAndNegative bool

if set to true [is positive and negative].

Fields

Id

Unique Id for a particular button Type.

public readonly int Id

Field Value

int

Index

protected readonly int Index

Field Value

int

IsPositiveAndNegative

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

public readonly bool IsPositiveAndNegative

Field Value

bool

ShortName

The short name of this button.

public readonly string ShortName

Field Value

string

Type

Type of this button.

public readonly VirtualButtonType Type

Field Value

VirtualButtonType

Properties

Name

The full name of this button.

public string Name { get; }

Property Value

string

Registered

Gets all registered VirtualButton.

public static IReadOnlyCollection<VirtualButton> Registered { get; }

Property Value

IReadOnlyCollection<VirtualButton>

The registered virtual buttons.

Methods

BuildButtonName()

protected virtual string BuildButtonName()

Returns

string

Find(int)

Finds a virtual button by the specified id.

public static VirtualButton Find(int id)

Parameters

id int

The id.

Returns

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

name string

The name.

Returns

VirtualButton

An instance of VirtualButton or null if no match.

GetValue(InputManager)

Gets the value associated with this virtual button from an input manager.

public abstract float GetValue(InputManager manager)

Parameters

manager InputManager

The manager.

Returns

float

System.Single.

IsDown(InputManager)

Indicate if the button is currently down

public abstract bool IsDown(InputManager manager)

Parameters

manager InputManager

The input manager

Returns

bool

IsPressed(InputManager)

Indicate if the button has been pressed since the last frame

public abstract bool IsPressed(InputManager manager)

Parameters

manager InputManager

The input manager

Returns

bool

IsReleased(InputManager)

Indicate if the button has been released since the last frame

public abstract bool IsReleased(InputManager manager)

Parameters

manager InputManager

The input manager

Returns

bool

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator +(IVirtualButton, VirtualButton)

Implements the + operator to combine to VirtualButton.

public static IVirtualButton operator +(IVirtualButton left, VirtualButton right)

Parameters

left IVirtualButton

The left virtual button.

right VirtualButton

The right virtual button.

Returns

IVirtualButton

A set containting the two virtual buttons.