DEKI/ENGINE docs
deki-input 0.19.0
Deki package reference
deki-input

Input handling and collision detection

Repository: github.com/dekiengine/deki-input · Latest release: 0.19.0 · Needs engine 0.19.0+ · Requires: deki-rendering

Install with DekiEditor --packages-add deki-input <project>, or from the Package Manager. The engine's own components and C++ API are in the Deki docs.

Shown in the editor as Input.

Components

Component Category Description
I2CKeyboardComponent Input Reads a keyboard that hands over one typed character per I2C read: the LilyGO T-Deck's, the M5Stack CardKB.
InputCollider Input Hit area for pointer and touch. Buttons and scrolls listen to it.
TrackballComponent Input A trackball on GPIO pins, as arrow keys and Enter or as a pointer.

Feature flags

Parts you can leave out of a build. A feature with a define is switched there; the rest are stripped with their components.

Feature Define Default
Colliders DEKI_FEATURE_INPUT on
I2C Keyboard DEKI_FEATURE_INPUT_I2C_KEYBOARD on
Trackball DEKI_FEATURE_INPUT_TRACKBALL on

Component reference

I2CKeyboardComponent

Reads a keyboard that hands over one typed character per I2C read: the LilyGO T-Deck's, the M5Stack CardKB.

Inspector name: I2C Keyboard · Category: Input · Type: DekiInput::I2CKeyboardComponent

Property Type Default Constraints Description
i2cPort int32 0 0 to 3 Which I2C bus the keyboard is on. Must match the I2C Bus component that set that port up.
i2cAddress int32 85 0 to 127 The keyboard's address on the bus: 0x55 (85) for the LilyGO T-Deck, 0x5F (95) for the M5Stack CardKB.
hasBacklight bool false The keyboard has a backlight it controls itself, set over the bus (the LilyGO T-Deck's: brightness in register 0x01). Game code then sets it with I2CKeyboard::SetBacklight.

InputCollider

Hit area for pointer and touch. Buttons and scrolls listen to it.

Inspector name: Input Collider · Category: Input · Type: DekiInput::InputCollider

Property Type Default Constraints Description
width float 0 in m Width of the hit area in meters. It does not have to match what is drawn.
height float 0 in m Height of the hit area in meters.
paddingLeft float 0 in m Extra hit area beyond the left edge, in meters. Useful for making a small control comfortable to hit with a finger without making it look bigger.
paddingRight float 0 in m Extra hit area beyond the right edge, in meters.
paddingTop float 0 in m Extra hit area above the top edge, in meters.
paddingBottom float 0 in m Extra hit area below the bottom edge, in meters.
consumeInput bool true Stop the press here instead of letting it reach objects underneath. Turn it off for an overlay that should not block what is behind it.

TrackballComponent

A trackball on GPIO pins, as arrow keys and Enter or as a pointer.

Inspector name: Trackball · Category: Input · Type: DekiInput::TrackballComponent

Property Type Default Constraints Description
mode enum "Keys" Keys, Pointer Keys: rolling presses the arrow keys and the click is Enter. Pointer: rolling moves a pointer and the click is a mouse button.
pixelsPerStep int32 4 1 to 64 Pointer mode: how many pixels one step of the ball moves the pointer
glideMs float 0 0 to 1000 Pointer mode: how long the pointer keeps gliding after the ball stops, in milliseconds, like a ThinkPad TrackPoint. 0 moves it exactly by the steps rolled.
acceleration float 1 1 to 8 Pointer mode with a glide: how many times further each step carries the pointer when the ball is spun fast than when it is rolled slowly. 1: no acceleration.
upPin int32 -1 -1 to 48 The line that pulses when the ball rolls up
downPin int32 -1 -1 to 48 The line that pulses when the ball rolls down
leftPin int32 -1 -1 to 48 The line that pulses when the ball rolls left
rightPin int32 -1 -1 to 48 The line that pulses when the ball rolls right
clickPin int32 -1 -1 to 48 The click switch (-1 = none)
clickActiveLow bool true The click pulls its pin low when pressed (on), or high (off)

Changelog

0.19.0

Changed

  • minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.

Added

  • Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.

0.18.2

Added

  • The keyboard's backlight: I2CKeyboard::SetBacklight(0-255), for a keyboard that sets it itself over the bus (hasBacklight on I2CKeyboardComponent; the LilyGO T-Deck's takes it in register 0x01).
  • The trackball can move like a ThinkPad TrackPoint (pointer mode, glideMs and acceleration on TrackballComponent): rolling sets the pointer going and it glides on briefly after the ball stops, and spinning the ball fast carries it further per step. glideMs 0, the default, moves it exactly by the steps rolled, as before.
  • InputEvent::source: the name the source that sent an event was registered under ("I2CKeyboard", "Trackball", "SDL3", ...), so a listener can tell a trackball's arrows from a keyboard's.
  • RegisterEventCallback returns an id, and UnregisterEventCallback(id) removes the callback. A component that listens must stop before it is destroyed; there was no way to.

Earlier releases: CHANGELOG.md.


Generated from the package's reflection data (engine 0.19.0). Property names are the keys used in scene files. Renames keep an alias (compatibility).