class FlxKeyManager<Key, KeyList>
package flixel.input
implements IFlxInputManager
extended by FlxKeyboard
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
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.
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.
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.