@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / InputActions
Class: InputActions ​
Defined in: input/actions.ts:95
Constructors ​
Constructor ​
new InputActions(actions?): InputActions;Defined in: input/actions.ts:107
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
actions | InputActionMap | DEFAULT_INPUT_ACTIONS |
Returns ​
InputActions
Properties ​
| Property | Type | Defined in |
|---|---|---|
tuning | InputTuning | input/actions.ts:100 |
Methods ​
getActions() ​
getActions(): InputActionMap;Defined in: input/actions.ts:114
Every action and its bindings, as they are now.
Returns ​
getDefaultActions() ​
getDefaultActions(): InputActionMap;Defined in: input/actions.ts:119
The bindings a game shipped with, before any rebind.
Returns ​
defineActions() ​
defineActions(actions): void;Defined in: input/actions.ts:124
Add or replace actions. Bindings for a new action become its defaults.
Parameters ​
| Parameter | Type |
|---|---|
actions | InputActionMap |
Returns ​
void
getBindings() ​
getBindings(action): string[];Defined in: input/actions.ts:132
Parameters ​
| Parameter | Type |
|---|---|
action | string |
Returns ​
string[]
setBindings() ​
setBindings(action, bindings): boolean;Defined in: input/actions.ts:137
Replace one action's bindings. Unknown actions are refused.
Parameters ​
| Parameter | Type |
|---|---|
action | string |
bindings | string[] |
Returns ​
boolean
resetBindings() ​
resetBindings(action?): void;Defined in: input/actions.ts:147
Back to the shipped bindings, for one action or all of them.
Parameters ​
| Parameter | Type |
|---|---|
action? | string |
Returns ​
void
getBindingOverrides() ​
getBindingOverrides(): Record<string, string[]>;Defined in: input/actions.ts:157
Bindings that differ from the defaults, for saving.
Returns ​
Record<string, string[]>
applyBindingOverrides() ​
applyBindingOverrides(overrides): void;Defined in: input/actions.ts:167
Apply saved overrides on top of the defaults.
Parameters ​
| Parameter | Type |
|---|---|
overrides | Record<string, string[]> | undefined |
Returns ​
void
update() ​
update(reader, deltaTime): InputDevice | null;Defined in: input/actions.ts:180
Parameters ​
| Parameter | Type |
|---|---|
reader | InputSourceReader |
deltaTime | number |
Returns ​
InputDevice | null
getAction() ​
getAction(name): boolean;Defined in: input/actions.ts:346
Held: the action's input is down this frame.
Parameters ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
boolean
getActionDown() ​
getActionDown(name): boolean;Defined in: input/actions.ts:351
Pressed this frame.
Parameters ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
boolean
getActionUp() ​
getActionUp(name): boolean;Defined in: input/actions.ts:357
Released this frame.
Parameters ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
boolean
getActionValue() ​
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 ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
number
getAxis() ​
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 ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
{
x: number;
y: number;
}| Name | Type | Defined in |
|---|---|---|
x | number | input/actions.ts:368 |
y | number | input/actions.ts:368 |
getActionDevice() ​
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 ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
InputDevice | null
getNavigation() ​
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() ​
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() ​
reset(): void;Defined in: input/actions.ts:392
Returns ​
void

