Skip to main content

HardwareKeys

Kindclass
Packagebackend
Full namebackend.HardwareKeys
Sourcesource/backend/HardwareKeys.hx

Hardware triggers (non-standard device buttons such as the Android volume rocker) stored in the regular keybind map, next to keyboard keys.

Keyboard keys are never negative (they are SDL/Lime keycodes), so a hardware key code c is stored as -(OFFSET + c). Such values can't clash with a keyboard binding and are never handed to FlxG.keys: consumers must check isBind first.

Public fields​

NameTypeStaticDefaultNotes
KEYCODE_VOLUME_UPIntyes24final · Android KeyEvent keycodes for the volume rocker (see AndroidHardwareInput).
KEYCODE_VOLUME_DOWNIntyes25final

Public methods​

toBind​

static inline function toBind(keyCode:Int):FlxKey

Encodes a hardware key code as a keybind value.

ParameterTypeDefault
keyCodeInt—

View source

isBind​

static inline function isBind(key:FlxKey):Bool

True when the keybind value refers to a hardware trigger.

ParameterTypeDefault
keyFlxKey—

View source

keyCodeOf​

static function keyCodeOf(key:FlxKey):Int

Decodes a keybind value produced by toBind back into the hardware key code.

ParameterTypeDefault
keyFlxKey—

View source

getName​

static function getName(key:FlxKey):String

Human readable label for the options menu.

ParameterTypeDefault
keyFlxKey—

View source

Internals​

Private / internal members
FieldTypeStatic
OFFSETIntyes