On this page

britzl/defold-input/in.onscreen

Cross-platform input handling for Defold: keyboard, mouse, gamepad, touch, and on-screen controls.

  • GitHub: britzl/defold-input — pinned to 2fe3aed
    1. Pick a release from britzl/defold-input releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as onscreen from "in.onscreen"

Functions

create(config?: { touch: Hash; }): OnscreenInstance

Parameters

  • config?: { touch: Hash; }
    • touch: Hash

Returns

  • OnscreenInstance

reset(instance?: OnscreenInstance)

Parameters

  • instance?: OnscreenInstance

register_button(node: Opaque<"node">, settings: {} | undefined, fn: (action: Hash, node: Opaque<"node">, touch: {}) => void, instance?: OnscreenInstance)

Parameters

  • node: Opaque<"node">
  • settings: {} | undefined
  • fn: (action: Hash, node: Opaque<"node">, touch: {}) => void
  • instance?: OnscreenInstance

register_analog(node: Opaque<"node">, settings: { radius?: number; threshold?: number; } | undefined, fn: (action: Hash, node: Opaque<"node">, touch: {}) => void, instance?: OnscreenInstance)

Parameters

  • node: Opaque<"node">
  • settings: { radius?: number; threshold?: number; } | undefined
  • fn: (action: Hash, node: Opaque<"node">, touch: {}) => void
  • instance?: OnscreenInstance

on_input(action_id: Hash, action: {}, instance?: OnscreenInstance): boolean

Parameters

  • action_id: Hash
  • action: {}
  • instance?: OnscreenInstance

Returns

  • boolean

Variables

BUTTON: Hash

ANALOG: Hash

BUTTON_PRESSED: Hash

BUTTON_RELEASED: Hash

ANALOG_PRESSED: Hash

ANALOG_RELEASED: Hash

ANALOG_MOVED: Hash

ANALOG_LEFT: Hash

ANALOG_RIGHT: Hash

ANALOG_UP: Hash

ANALOG_DOWN: Hash