Table of Contents

Class GamepadButton

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The GamepadButton interface defines an individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device.

[Value("GamepadButton")]
public class GamepadButton
Inheritance
GamepadButton
Inherited Members

Remarks

A GamepadButton object is returned by querying any value of the array returned by the buttons property of the Gamepad interface.

Using the Gamepad API

See also on MDN

Constructors

GamepadButton()

public GamepadButton()

Properties

Pressed

The GamepadButton.pressed property of the
GamepadButton interface returns a boolean indicating whether
the button is currently pressed (true) or unpressed (false).

[Value("pressed")]
public bool Pressed { get; }

Property Value

bool

A boolean value.

Remarks

Touched

The touched property of the
GamepadButton interface returns a boolean indicating whether
a button capable of detecting touch is currently touched (true) or not touched (false).

[Value("touched")]
public bool Touched { get; }

Property Value

bool

A Boolean. True if touched.

Remarks

If the button is not capable of detecting touch but can return an analog value, the property will be true if the value is greater than 0, and false otherwise. If the button is not capable of detecting touch and can only report a digital value, then it should mirror the Pressed property.

-Using the Gamepad API

See also on MDN

Value

The GamepadButton.value property of the
GamepadButton interface returns a double value used to represent the
current state of analog buttons on many modern gamepads, such as the triggers.

[Value("value")]
public Number Value { get; }

Property Value

Number

A double.

Remarks

The values are normalized to the range 0.01.0, with
0.0 representing a button that is not pressed, and 1.0 representing a
button that is fully pressed.

Using the Gamepad API

See also on MDN