VirtualButton Class
Namespace: Stride.InputAssembly: 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
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. |
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 |
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 |
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. |
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
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. |