Constructors
constructor
- new Key(keyCode: number, descriptor: string, game: Game, scene: Scene, keyboardInput: KeyboardInput, 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
Properties
descriptor
descriptor: string
isJustPressed
isJustPressed: boolean
Methods
onInput
- onInput(cb: (key: Key, e: KeyboardEvent) => any): void
Parameters
cb: (key: Key, e: KeyboardEvent) => any
- (key: Key, e: KeyboardEvent): any
Returns void
Protected registerListeners
- registerListeners(): void
Creates a DuckEngine Key
The Key Class. Stores info about a key's state
2.0.0