Keeps track of what keys are pressed and how with handy Bools or strings. Automatically instatiated by flixel as a FlxKeyboard and accessed via FlxG.keys or FlxAndroidKeys with FlxG.android. Example: FlxG.keys.justPressed.A

Variables

@:value(true)enabled:Bool = true

Whether or not keyboard input is currently enabled.

read onlyjustPressed:KeyList

Helper class to check if a key was just pressed.

read onlyjustReleased:KeyList

Helper class to check if a key was just released.

read onlypressed:KeyList

Helper class to check if a key is pressed.

@:value([])preventDefaultKeys:Array<Key> = []

List of keys on which preventDefault() is called, useful on HTML5 to stop the browser from scrolling when pressing the up or down key for example, or on android to prevent the default back key action.

read onlyreleased:KeyList

Helper class to check if a key is released.

Available since

4.8.0

.

Methods

inlineanyJustPressed(KeyArray:Array<Key>):Bool

Check to see if at least one key from an array of keys was just pressed.

Parameters:

KeyArray

An array of key names

Returns:

Whether at least one of the keys passed was just pressed.

inlineanyJustReleased(KeyArray:Array<Key>):Bool

Check to see if at least one key from an array of keys was just released.

Parameters:

KeyArray

An array of key names

Returns:

Whether at least one of the keys passed was just released.

inlineanyPressed(KeyArray:Array<Key>):Bool

Check to see if at least one key from an array of keys is pressed.

Parameters:

KeyArray

An array of key names

Returns:

Whether at least one of the keys passed in is pressed.

checkStatus(KeyCode:Key, Status:FlxInputState):Bool

Check the status of a single of key

Parameters:

KeyCode

KeyCode to be checked.

Status

The key state to check for.

Returns:

Whether the provided key has the specified status.

destroy():Void

Clean up memory.

firstJustPressed():Int

Get the ID of the first key which has just been pressed.

Returns:

The ID of the key or -1 if none were just pressed.

firstJustReleased():Int

Get the ID of the first key which has just been released.

Returns:

The ID of the key or -1 if none were just released.

firstPressed():Int

Get the ID of the first key which is currently pressed.

Returns:

The ID of the first pressed key or -1 if none are pressed.

getIsDown():Array<FlxInput<Key>>

Get an Array of Key that are in a pressed state

Returns:

Array of keys that are currently pressed.

reset():Void

Resets all the keys.