HardwareKeys
| Kind | class |
| Package | backend |
| Full name | backend.HardwareKeys |
| Source | source/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
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
KEYCODE_VOLUME_UP | Int | yes | 24 | final · Android KeyEvent keycodes for the volume rocker (see AndroidHardwareInput). |
KEYCODE_VOLUME_DOWN | Int | yes | 25 | final |
Public methods
toBind
static inline function toBind(keyCode:Int):FlxKey
Encodes a hardware key code as a keybind value.
| Parameter | Type | Default |
|---|---|---|
keyCode | Int | — |
isBind
static inline function isBind(key:FlxKey):Bool
True when the keybind value refers to a hardware trigger.
| Parameter | Type | Default |
|---|---|---|
key | FlxKey | — |
keyCodeOf
static function keyCodeOf(key:FlxKey):Int
Decodes a keybind value produced by toBind back into the hardware key code.
| Parameter | Type | Default |
|---|---|---|
key | FlxKey | — |
getName
static function getName(key:FlxKey):String
Human readable label for the options menu.
| Parameter | Type | Default |
|---|---|---|
key | FlxKey | — |
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
OFFSET | Int | yes |