InputMapImpl
Implementation class for the InputMap system.
This class provides the actual functionality for mapping physical inputs
(keyboard, mouse, gamepad) to logical game actions. It supports complex
input scenarios including:
- Multiple inputs bound to a single action
- Digital-to-analog conversion (e.g., WASD to movement axis)
- Analog-to-digital conversion (e.g., trigger press threshold)
- Input state tracking (pressed, just pressed, just released)
- Gamepad-specific targeting
- UI focus integration
The implementation uses an efficient index-based system to track bindings
and input states, minimizing overhead during runtime input processing.
Instance Members
Target events of a specific gamepad by setting its gamepad id.
If kept to default (-1), events from any gamepad will be handled.
Useful for multiplayer games where each player has their own controller.
checkJustPressedAtBind: Bool
If set to true, when binding a new input, the system will check if
the input was just pressed this frame and set the initial state accordingly.
This prevents immediate triggering of "just pressed" events when binding
an input that's already being held down.
Set to false to disable this input map entirely.
When disabled, all input queries will return false/0.0 and no events will be triggered.
Useful for pausing input handling or switching between different input schemes.
bindKeyCode(key: ceramic.InputMapImpl.T, keyCode: KeyCode): Void
Binds a keyboard key code to an action.
Multiple key codes can be bound to the same action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to bind to |
keyCode |
KeyCode |
The keyboard key code to bind |
Gets all key codes currently bound to an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to query |
unbindKeyCode(key: ceramic.InputMapImpl.T, keyCode: KeyCode): Void
Removes a key code binding from an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to unbind from |
keyCode |
KeyCode |
The key code to unbind |
bindKeyCodeToAxis(key: ceramic.InputMapImpl.T, keyCode: KeyCode, axisValue: Float): Void
Binds a keyboard key to an analog axis action.
When the key is pressed, it will set the axis to the specified value.
Useful for digital-to-analog conversion (e.g., WASD to movement).
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to bind to |
keyCode |
KeyCode |
The keyboard key code to bind |
axisValue |
Float |
The axis value when pressed (typically -1.0 or 1.0) |
Gets all key codes bound to an axis action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to query |
boundKeyCodeToAxisValue(key: ceramic.InputMapImpl.T, keyCode: KeyCode): Float
Gets the axis value associated with a key code binding.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action |
keyCode |
KeyCode |
The key code to check |
| Returns |
Description |
| Float |
The axis value for this binding, or 0 if not bound |
unbindKeyCodeToAxis(key: ceramic.InputMapImpl.T, keyCode: KeyCode): Void
Removes a key code to axis binding.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to unbind from |
keyCode |
KeyCode |
The key code to unbind |
bindScanCode(key: ceramic.InputMapImpl.T, scanCode: ScanCode): Void
Binds a keyboard scan code to an action.
Scan codes represent physical key positions and are layout-independent.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to bind to |
scanCode |
ScanCode |
The scan code to bind |
Gets all scan codes currently bound to an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to query |
unbindScanCode(key: ceramic.InputMapImpl.T, scanCode: ScanCode): Void
Removes a scan code binding from an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to unbind from |
scanCode |
ScanCode |
The scan code to unbind |
bindScanCodeToAxis(key: ceramic.InputMapImpl.T, scanCode: ScanCode, axisValue: Float): Void
| Name |
Type |
key |
ceramic.InputMapImpl.T |
scanCode |
ScanCode |
axisValue |
Float |
| Name |
Type |
key |
ceramic.InputMapImpl.T |
boundScanCodeToAxisValue(key: ceramic.InputMapImpl.T, scanCode: ScanCode): Float
| Name |
Type |
key |
ceramic.InputMapImpl.T |
scanCode |
ScanCode |
unbindScanCodeToAxis(key: ceramic.InputMapImpl.T, scanCode: ScanCode): Void
| Name |
Type |
key |
ceramic.InputMapImpl.T |
scanCode |
ScanCode |
Binds a mouse button to an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to bind to |
buttonId |
Int |
The mouse button ID (0=left, 1=right, 2=middle) |
Gets all mouse buttons currently bound to an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to query |
| Returns |
Description |
| ReadOnlyArray<Int> |
Array of bound mouse button IDs (empty if none) |
Removes a mouse button binding from an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to unbind from |
buttonId |
Int |
The mouse button ID to unbind |
Binds a gamepad button to an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to bind to |
button |
GamepadButton |
The gamepad button to bind |
Gets all gamepad buttons currently bound to an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to query |
Removes a gamepad button binding from an action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to unbind from |
button |
GamepadButton |
The gamepad button to unbind |
| Name |
Type |
key |
ceramic.InputMapImpl.T |
Binds a gamepad analog axis to an axis action.
The axis value will be passed through directly.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to bind to |
axis |
GamepadAxis |
The gamepad axis to bind |
Gets all gamepad axes currently bound to an axis action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to query |
Removes a gamepad axis binding from an axis action.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to unbind from |
axis |
GamepadAxis |
The gamepad axis to unbind |
Binds a gamepad axis to a button action with a threshold.
The button will be "pressed" when the axis value crosses the threshold.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The button action to bind to |
axis |
GamepadAxis |
The gamepad axis to bind |
startValue |
Float |
The threshold value (positive for > threshold, negative for < threshold) |
| Name |
Type |
key |
ceramic.InputMapImpl.T |
bindConvertedToAxis(key: ceramic.InputMapImpl.T, axisKey: ceramic.InputMapImpl.T, axisValue: Float): Void
Binds a button action to trigger an axis action when pressed.
This allows button presses to set axis values.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The button action that triggers the axis |
axisKey |
ceramic.InputMapImpl.T |
The axis action to trigger |
axisValue |
Float |
The axis value to set when button is pressed |
pressed(key: ceramic.InputMapImpl.T): Bool
Checks if an action is currently pressed (held down).
Returns true for every frame while the input is held.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to check |
| Returns |
Description |
| Bool |
True if the action is currently pressed |
justPressed(key: ceramic.InputMapImpl.T): Bool
Checks if an action was just pressed this frame.
Returns true only on the frame the input was initially pressed.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to check |
| Returns |
Description |
| Bool |
True if the action was just pressed this frame |
justReleased(key: ceramic.InputMapImpl.T): Bool
Checks if an action was just released this frame.
Returns true only on the frame the input was released.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action to check |
| Returns |
Description |
| Bool |
True if the action was just released this frame |
axisValue(key: ceramic.InputMapImpl.T): Float
Gets the current value of an axis action.
Returns 0.0 if the input map is disabled or no axis is active.
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The axis action to check |
| Returns |
Description |
| Float |
The current axis value (typically -1.0 to 1.0) |
Private Members
indexToKey: Array<ceramic.InputMapImpl.T>
A way to know from which the pressed key comes from
emitKeyDown(key: ceramic.InputMapImpl.T): Void
Triggered when a mapped action is pressed (key down, button pressed, etc.).
@event keyDown
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action that was pressed |
emitKeyUp(key: ceramic.InputMapImpl.T): Void
Triggered when a mapped action is released (key up, button released, etc.).
@event keyUp
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action that was released |
emitAxis(key: ceramic.InputMapImpl.T, value: Float): Void
Triggered when an analog axis value changes for a mapped action.
@event axis
| Name |
Type |
Description |
key |
ceramic.InputMapImpl.T |
The action associated with the axis |
value |
Float |
The new axis value (typically -1.0 to 1.0) |
keyToString(key: ceramic.InputMapImpl.T): String
| Name |
Type |
key |
ceramic.InputMapImpl.T |
keyForIndex(index: Int): ceramic.InputMapImpl.T
| Returns |
| ceramic.InputMapImpl.T |
indexOfKey(key: ceramic.InputMapImpl.T): Int
| Name |
Type |
key |
ceramic.InputMapImpl.T |
| Name |
Parameters |
:hxGen |
- |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |