Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / InputActions

Class: InputActions ​

Defined in: input/actions.ts:95

Constructors ​

Constructor ​

ts
new InputActions(actions?): InputActions;

Defined in: input/actions.ts:107

Parameters ​

ParameterTypeDefault value
actionsInputActionMapDEFAULT_INPUT_ACTIONS

Returns ​

InputActions

Properties ​

PropertyTypeDefined in
tuningInputTuninginput/actions.ts:100

Methods ​

getActions() ​

ts
getActions(): InputActionMap;

Defined in: input/actions.ts:114

Every action and its bindings, as they are now.

Returns ​

InputActionMap


getDefaultActions() ​

ts
getDefaultActions(): InputActionMap;

Defined in: input/actions.ts:119

The bindings a game shipped with, before any rebind.

Returns ​

InputActionMap


defineActions() ​

ts
defineActions(actions): void;

Defined in: input/actions.ts:124

Add or replace actions. Bindings for a new action become its defaults.

Parameters ​

ParameterType
actionsInputActionMap

Returns ​

void


getBindings() ​

ts
getBindings(action): string[];

Defined in: input/actions.ts:132

Parameters ​

ParameterType
actionstring

Returns ​

string[]


setBindings() ​

ts
setBindings(action, bindings): boolean;

Defined in: input/actions.ts:137

Replace one action's bindings. Unknown actions are refused.

Parameters ​

ParameterType
actionstring
bindingsstring[]

Returns ​

boolean


resetBindings() ​

ts
resetBindings(action?): void;

Defined in: input/actions.ts:147

Back to the shipped bindings, for one action or all of them.

Parameters ​

ParameterType
action?string

Returns ​

void


getBindingOverrides() ​

ts
getBindingOverrides(): Record<string, string[]>;

Defined in: input/actions.ts:157

Bindings that differ from the defaults, for saving.

Returns ​

Record<string, string[]>


applyBindingOverrides() ​

ts
applyBindingOverrides(overrides): void;

Defined in: input/actions.ts:167

Apply saved overrides on top of the defaults.

Parameters ​

ParameterType
overridesRecord<string, string[]> | undefined

Returns ​

void


update() ​

ts
update(reader, deltaTime): InputDevice | null;

Defined in: input/actions.ts:180

Parameters ​

ParameterType
readerInputSourceReader
deltaTimenumber

Returns ​

InputDevice | null


getAction() ​

ts
getAction(name): boolean;

Defined in: input/actions.ts:346

Held: the action's input is down this frame.

Parameters ​

ParameterType
namestring

Returns ​

boolean


getActionDown() ​

ts
getActionDown(name): boolean;

Defined in: input/actions.ts:351

Pressed this frame.

Parameters ​

ParameterType
namestring

Returns ​

boolean


getActionUp() ​

ts
getActionUp(name): boolean;

Defined in: input/actions.ts:357

Released this frame.

Parameters ​

ParameterType
namestring

Returns ​

boolean


getActionValue() ​

ts
getActionValue(name): number;

Defined in: input/actions.ts:363

0..1: a trigger's pull, or 1 for a key. For an axis, its length.

Parameters ​

ParameterType
namestring

Returns ​

number


getAxis() ​

ts
getAxis(name): {
  x: number;
  y: number;
};

Defined in: input/actions.ts:368

A direction. move: -1..1, y forward. look: pixels this frame, y down.

Parameters ​

ParameterType
namestring

Returns ​

ts
{
  x: number;
  y: number;
}
NameTypeDefined in
xnumberinput/actions.ts:368
ynumberinput/actions.ts:368

getActionDevice() ​

ts
getActionDevice(name): InputDevice | null;

Defined in: input/actions.ts:374

The device that drove an action this frame, or null when it's idle.

Parameters ​

ParameterType
namestring

Returns ​

InputDevice | null


getNavigation() ​

ts
getNavigation(): NavigationDirection | null;

Defined in: input/actions.ts:382

One menu step from navigate: the frame a direction is pushed, then again every ~0.1 s while it's held. Null on other frames.

Returns ​

NavigationDirection | null


clearEdges() ​

ts
clearEdges(): void;

Defined in: input/actions.ts:387

Forget every edge, so a press that opened a menu doesn't land in it.

Returns ​

void


reset() ​

ts
reset(): void;

Defined in: input/actions.ts:392

Returns ​

void