Home Reference Source Test
import {_InputManager} from 'seed-engine/src/manager/InputManager.js'
private class | source

_InputManager

You can directly use an instance of this class. InputManager

Extends:

Manager → _InputManager

A manager class intended to manage the javascript callback associated with the DOM. The InputManager filters general DOM events such as key down, key up, left and right click. The manager sorts events into referenceable lists for components to reference each game tick.

In result, the InputManager creates a bridge between the DOM and Engine. Components should use the is functions to determine if a specific character is down for that game tick.

If you want to listen to all characters, for example a textbox input, use events instead. To listen to events, use InputManager.events to access the event. Events are defined in InputManager.EVENT. See Messager.js for more info on listening to events.

Constructor Summary

Public Constructor
public

Constructor.

Member Summary

Public Members
public

EVENT: {"LEFT_PRESSED": string, "LEFT_RELEASED": string, "RIGHT_PRESSED": string, "RIGHT_RELEASED": string, "MOUSE_MOVE": string, "KEY_DOWN": string, "KEY_UP": string, "KEY": string}

public

KEY_DOWN: *[]

public
public

KEY_UP: *[]

public
public
public
public
public

events: *

Method Summary

Public Methods
public

Returns true if the key represented by this KeyCode is pressed down on this game tick.

public

Returns true if the key represented by this KeyCode is held down on this game tick.

public

isKeyUp(KeyCode: KeyCode): boolean

Returns true if the key represented by this KeyCode is released on this game tick.

public

start()

Called by the EngineManager.

public

update()

Managed by the EngineManager.

Inherited Summary

From class Manager
public

end()

public

pause()

public

start()

public
public

update()

Public Constructors

public constructor() source

Constructor. Initializes Messager, event definitons, and key and mouse states.

Override:

Manager#constructor

Public Members

public EVENT: {"LEFT_PRESSED": string, "LEFT_RELEASED": string, "RIGHT_PRESSED": string, "RIGHT_RELEASED": string, "MOUSE_MOVE": string, "KEY_DOWN": string, "KEY_UP": string, "KEY": string} source

public KEY_DOWN: *[] source

public KEY_PRESSED: *[] source

public KEY_UP: *[] source

public LEFT_PRESSED: *[] source

public LEFT_RELEASED: *[] source

public RIGHT_PRESSED: *[] source

public RIGHT_RELEASED: *[] source

public events: * source

Public Methods

public isKeyDown(KeyCode: KeyCode): boolean source

Returns true if the key represented by this KeyCode is pressed down on this game tick. Does not repeat each game tick. Must be released to re-trigger. The isKeyPressed() will also return true when this function does.

Params:

NameTypeAttributeDescription
KeyCode KeyCode

Keycode enum which represents a character by number.

Return:

boolean

Is this key down.

public isKeyPressed(KeyCode: KeyCode): boolean source

Returns true if the key represented by this KeyCode is held down on this game tick. Repeats each game tick it is held down.

Params:

NameTypeAttributeDescription
KeyCode KeyCode

Keycode enum which represents a character by number.

Return:

boolean

Is this key pressed (held down).

public isKeyUp(KeyCode: KeyCode): boolean source

Returns true if the key represented by this KeyCode is released on this game tick.

Params:

NameTypeAttributeDescription
KeyCode KeyCode

Keycode enum which represents a character by number.

Return:

boolean

Is this key released.

public start() source

Called by the EngineManager. Not intended to be referenced. Sets up event listeners on the DOM.

Override:

Manager#start

public update() source

Managed by the EngineManager. Do not call directly. Updates character and mouse inputs.

Override:

Manager#update