Skip to main content

Class: GamepadInputRelay

Defined in: livelink.js/sources/inputs/GamepadInputRelay.ts:123

It serves as an interface between high level gamepad input representations and the server.

Methods

setAxis()

setAxis(params: {
axis: GamepadAxisType;
value: number;
}): void

Defined in: livelink.js/sources/inputs/GamepadInputRelay.ts:168

Set the value of a single axis.

Parameters

ParameterTypeDescription
params{ axis: GamepadAxisType; value: number; }
params.axisGamepadAxisTypeThe axis to set.
params.valuenumberThe value to set. 0 means the axis is centered.

Returns

void


setJoystick()

setJoystick(params: {
joystick: GamepadJoystickType;
value: [number, number];
}): void

Defined in: livelink.js/sources/inputs/GamepadInputRelay.ts:182

Set the values of the two axes composing a joystick.

Parameters

ParameterTypeDescription
params{ joystick: GamepadJoystickType; value: [number, number]; }
params.joystickGamepadJoystickTypeThe joystick to set.
params.value[number, number]The values to set for the joystick. The first number is the horizontal axis and the second number is the vertical axis. 0 means the joystick is centered.

Returns

void


setButton()

setButton(params: {
button: GamepadButtonType;
isPressed: boolean;
}): void

Defined in: livelink.js/sources/inputs/GamepadInputRelay.ts:194

Set the value of a single button.

Parameters

ParameterTypeDescription
params{ button: GamepadButtonType; isPressed: boolean; }
params.buttonGamepadButtonTypeThe button to set.
params.isPressedbooleanA boolean indicating whether the button is pressed (true) or not (false).

Returns

void


setButtons()

setButtons(params: {
buttons: boolean[];
}): void

Defined in: livelink.js/sources/inputs/GamepadInputRelay.ts:208

Set the values of all buttons.

Parameters

ParameterTypeDescription
params{ buttons: boolean[]; }
params.buttonsboolean[]An array of buttons value, sorted following the indexes referenced by the GamepadButton enum.

Returns

void


resetInput()

resetInput(): void

Defined in: livelink.js/sources/inputs/GamepadInputRelay.ts:228

Reset all the input values to their default state.

Returns

void