Skip to main content

Class: InputManager

Defined in: input/input-manager.ts:14

InputManager is responsible for managing input sources, groups, and actions. It is the top-level class that coordinates input handling.

Implements

Constructors

Constructor

new InputManager(activeGroup): InputManager

Defined in: input/input-manager.ts:25

Constructs a new InputManager.

Parameters

activeGroup

string = 'game'

Returns

InputManager

Accessors

activeGroup

Get Signature

get activeGroup(): null | string

Defined in: input/input-manager.ts:177

Gets the currently active input group, or null if none is active.

Returns

null | string

Methods

addAxis1dActions()

addAxis1dActions(...actions): void

Defined in: input/input-manager.ts:50

Adds a new 1D axis action to the manager and marks it as resettable.

Parameters

actions

...Axis1dAction[]

Returns

void


addAxis2dActions()

addAxis2dActions(...actions): void

Defined in: input/input-manager.ts:61

Adds a new 2D axis action to the manager and marks it as resettable.

Parameters

actions

...Axis2dAction[]

Returns

void


addHoldActions()

addHoldActions(...actions): void

Defined in: input/input-manager.ts:72

Adds a new hold action to the manager.

Parameters

actions

...HoldAction[]

Returns

void


addResettable()

addResettable(...resettables): void

Defined in: input/input-manager.ts:259

Adds one or more resettable sources to the manager.

Parameters

resettables

...Resettable[]

The resettable sources to add.

Returns

void


addTriggerActions()

addTriggerActions(...actions): void

Defined in: input/input-manager.ts:39

Adds new actions to the manager.

Parameters

actions

...TriggerAction[]

Returns

void


addUpdatable()

addUpdatable(...updatables): void

Defined in: input/input-manager.ts:243

Adds one or more updatable sources to the manager.

Parameters

updatables

...Updatable[]

The updatable sources to add.

Returns

void


dispatchAxis1dAction()

dispatchAxis1dAction(binding, value): void

Defined in: input/input-manager.ts:196

Dispatches a 1D axis action if its input group is active.

Parameters

binding

InputBinding<Axis1dAction>

The input binding containing the action to set.

value

number

The value to set for the axis action.

Returns

void


dispatchAxis2dAction()

dispatchAxis2dAction(binding, x, y): void

Defined in: input/input-manager.ts:211

Dispatches a 2D axis action if its input group is active.

Parameters

binding

InputBinding<Axis2dAction>

The input binding containing the action to set.

x

number

The x value to set for the axis action.

y

number

The y value to set for the axis action.

Returns

void


dispatchHoldEndAction()

dispatchHoldEndAction(binding): void

Defined in: input/input-manager.ts:235

Dispatches the end of a hold action.

Parameters

binding

InputBinding<HoldAction>

The input binding containing the action to end.

Returns

void


dispatchHoldStartAction()

dispatchHoldStartAction(binding): void

Defined in: input/input-manager.ts:225

Dispatches the start of a hold action if its input group is active.

Parameters

binding

InputBinding<HoldAction>

The input binding containing the action to start.

Returns

void


dispatchTriggerAction()

dispatchTriggerAction(binding): void

Defined in: input/input-manager.ts:185

Dispatches a trigger action if its input group is active.

Parameters

binding

InputBinding<TriggerAction>

The input binding containing the action to trigger.

Returns

void


getAxis1dAction()

getAxis1dAction(name): Axis1dAction

Defined in: input/input-manager.ts:129

Gets a 1D axis action by name.

Parameters

name

string

The name of the action to get.

Returns

Axis1dAction

The Axis1dAction with the specified name.

Throws

Error if no action with the specified name is found.


getAxis2dAction()

getAxis2dAction(name): Axis2dAction

Defined in: input/input-manager.ts:144

Gets a 2D axis action by name.

Parameters

name

string

The name of the action to get.

Returns

Axis2dAction

The Axis2dAction with the specified name.

Throws

Error if no action with the specified name is found.


getHoldAction()

getHoldAction(name): HoldAction

Defined in: input/input-manager.ts:159

Gets a hold action by name.

Parameters

name

string

The name of the action to get.

Returns

HoldAction

The HoldAction with the specified name.

Throws

Error if no action with the specified name is found.


getTriggerAction()

getTriggerAction(name): TriggerAction

Defined in: input/input-manager.ts:114

Gets a trigger action by name.

Parameters

name

string

The name of the action to get.

Returns

TriggerAction

The TriggerAction with the specified name.

Throws

Error if no action with the specified name is found.


removeAxis1dAction()

removeAxis1dAction(action): void

Defined in: input/input-manager.ts:89

Removes a 1D axis action from the manager and unmarks it as resettable.

Parameters

action

Axis1dAction

The action to remove.

Returns

void


removeAxis2dAction()

removeAxis2dAction(action): void

Defined in: input/input-manager.ts:97

Removes a 2D axis action from the manager and unmarks it as resettable.

Parameters

action

Axis2dAction

The action to remove.

Returns

void


removeHoldAction()

removeHoldAction(action): void

Defined in: input/input-manager.ts:105

Removes a hold action from the manager.

Parameters

action

HoldAction

The action to remove.

Returns

void


removeResettable()

removeResettable(resettable): void

Defined in: input/input-manager.ts:268

Removes a resettable source from the manager.

Parameters

resettable

Resettable

The resettable source to remove.

Returns

void


removeTriggerAction()

removeTriggerAction(action): void

Defined in: input/input-manager.ts:81

Removes a trigger action from the manager and unmarks it as resettable.

Parameters

action

TriggerAction

The action to remove.

Returns

void


removeUpdatable()

removeUpdatable(source): void

Defined in: input/input-manager.ts:252

Removes an updatable source from the manager.

Parameters

source

Updatable

The updatable source to remove.

Returns

void


reset()

reset(): void

Defined in: input/input-manager.ts:282

Resets all resettable sources.

Returns

void


setActiveGroup()

setActiveGroup(group): void

Defined in: input/input-manager.ts:172

Sets the active input group.

Parameters

group

The name of the group to set as active, or null to clear.

null | string

Returns

void


update()

update(deltaTime): void

Defined in: input/input-manager.ts:275

Updates the object with the given time.

Parameters

deltaTime

number

The time elapsed since the last update, in milliseconds.

Returns

void

Implementation of

Updatable.update