Class: ManualInput

ManualInput


new ManualInput(options)

A ManualInput is an input device that will transmit any state you manually set from a Javascript API. It's a strictly better NullInput, that works on any environment while still giving you a way to trigger some events when you need to.

Parameters:
Name Type Argument Description
options object <optional>

The device options.

Properties
Name Type Argument Description
codeMap object <optional>

The initial code map.

Implements:
Source:

Members


<readonly> codeMap :object

This value contains the current code map used to translate codes.

Type:
  • object
Source:

Methods


down(port, code)

Set an input slot as being pressed.

Parameters:
Name Type Description
port number

The input slot controller port.

code number

The input slot code.

Source:

getState(port, code)

An engine will call this function to check the current state of a specified input. The function will return true if the input is currently active (pressed), and false otherwise.

Parameters:
Name Type Description
port number

The input controller port.

code number

The input code.

Implements:
Source:

pollInputs()

An engine will call this function to inform the device that it should update the input state.

It means that the devices should never update the input state by themselves, but rather wait for the engine order. It is also important that the update is done synchronously, so that right after returning, the engines are able to call Input#getState.

Implements:
Source:

setCodeMap(codeMap)

Set the code map that will be used to translate input codes from one to another.

Parameters:
Name Type Description
codeMap object

The new input map.

Source:

up(port, code)

Set an input slot as being released.

Parameters:
Name Type Description
port number

The input slot controller port.

code number

The input slot code.

Source: