Methods
addKey
- addKey(keyCode: number, descriptor: string, keyDown?: (e: KeyboardEvent) => any, keyUp?: (e: KeyboardEvent) => any, keyJustPressed?: (e: KeyboardEvent) => any, keyState?: (e: KeyboardEvent, state: boolean) => any): Key
Parameters
keyCode: number
descriptor: string
Optional keyDown: (e: KeyboardEvent) => any
Optional keyUp: (e: KeyboardEvent) => any
Optional keyJustPressed: (e: KeyboardEvent) => any
Optional keyState: (e: KeyboardEvent, state: boolean) => any
- (e: KeyboardEvent, state: boolean): any
Parameters
e: KeyboardEvent
state: boolean
Returns any
Returns Key
onInput
- onInput(cb: (key: Key, e: KeyboardEvent) => any): void
Parameters
cb: (key: Key, e: KeyboardEvent) => any
- (key: Key, e: KeyboardEvent): any
Returns void
removeKey
- removeKey(descriptor: string): void
Creates a DuckEngine KeyboardInput
The KeyboardInput Class. Use the Keyboard as input
2.0.0