class flixel.input.keyboard.FlxKeyboard implements IFlxInput

Available on all platforms

Keeps track of what keys are pressed and how with handy Bools or strings.

Instance Fields

var enabled:Bool

Whether or not keyboard input is currently enabled.

var justPressed:FlxKeyList

Helper class to check if a keys was just pressed.

var justReleased:FlxKeyList

Helper class to check if a keys was just released.

var pressed:FlxKeyList

Helper class to check if a keys is pressed.

function anyJustPressed(KeyArray:Array<String>):Bool

Check to see if at least one key from an array of keys was just pressed. See FlxG.keys for the key names, pass them in as Strings. * Example: FlxG.keys.anyJustPressed(["UP", "W", "SPACE"]) - having them in an array is handy for configurable keys! * *

KeyArray

An array of keys as Strings *

returns

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

function anyJustReleased(KeyArray:Array<String>):Bool

Check to see if at least one key from an array of keys was just released. See FlxG.keys for the key names, pass them in as Strings. * Example: FlxG.keys.anyJustReleased(["UP", "W", "SPACE"]) - having them in an array is handy for configurable keys! * *

KeyArray

An array of keys as Strings *

returns

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

function anyPressed(KeyArray:Array<String>):Bool

Function and numpad keycodes on native targets are incorrect, * this workaround fixes that. Thanks @HaxePunk! * @see https://github.com/openfl/openfl-native/issues/193

function checkStatus(KeyCode:Int, Status:Int):Bool

Check the status of a single of key * *

KeyCode

Index into _keyList array. *

Status

The key state to check for *

returns

Whether the provided key has the specified status

function destroy():Void

Clean up memory.

function firstJustPressed():String

Get the name of the first key which has just been pressed. * *

returns

The name of the key or "" if none could be found.

function firstJustReleased():String

Get the name of the first key which has just been released. * *

returns

The name of the key or "" if none could be found.

function firstPressed():String

Get the name of the first key which is currently pressed. * *

returns

The name of the key or "" if none could be found.

function getIsDown():Array<FlxKey>

Get an Array of FlxMapObjects that are in a pressed state * *

returns

Array of keys that are currently pressed.

function getKeyCode(KeyName:String):Int

Look up the key code for any given string name of the key or button. * *

KeyName

The String name of the key. *

returns

The key code for that key.

function reset():Void

Resets all the keys.