Home Reference Source Repository
import KeyListener from 'dh3dlib/js/base/KeyListener.js'
public class | source

KeyListener

KeyListener class

Constructor Summary

Public Constructor
public

constructor

Method Summary

Public Methods
public

check if any key is pushed

public

getKeyNewState(keyCode: int): boolean

get key new state of given key code

public

getKeyState(keyCode: int): boolean

get key state of given key code

public

keyDownCallback(event: Event): void

callback for keyDown event

public

keyUpCallback(event: Event): void

callback for keyUp event

public

reset key new state

public

resetKeyState(): void

reset key state

public

setDisable(): void

disable key listener

public

setEnable(flag: boolean): void

enable/disable key listener

public

set keyDown callback function

public

setKeyUpCallback(func: Function): void

set keyUp callback function

Public Constructors

public constructor source

constructor

Public Methods

public getAnyKeyState(): boolean source

check if any key is pushed

Return:

boolean

true: pushed, false: not pushed

public getKeyNewState(keyCode: int): boolean source

get key new state of given key code

Params:

NameTypeAttributeDescription
keyCode int

key code

Return:

boolean

true: key down, false: key up

public getKeyState(keyCode: int): boolean source

get key state of given key code

Params:

NameTypeAttributeDescription
keyCode int

key code

Return:

boolean

true: key down, false: key up

public keyDownCallback(event: Event): void source

callback for keyDown event

Params:

NameTypeAttributeDescription
event Event

Return:

void

public keyUpCallback(event: Event): void source

callback for keyUp event

Params:

NameTypeAttributeDescription
event Event

Return:

void

public resetKeyNewState(): void source

reset key new state

Return:

void

public resetKeyState(): void source

reset key state

Return:

void

public setDisable(): void source

disable key listener

Return:

void

public setEnable(flag: boolean): void source

enable/disable key listener

Params:

NameTypeAttributeDescription
flag boolean

true: enable, false: disable

Return:

void

public setKeyDownCallback(func: Function): void source

set keyDown callback function

Params:

NameTypeAttributeDescription
func Function

callback function

Return:

void

public setKeyUpCallback(func: Function): void source

set keyUp callback function

Params:

NameTypeAttributeDescription
func Function

callback function

Return:

void