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- Pick a release from britzl/defold-input releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as onscreen from "in.onscreen"
- Pick a release from britzl/defold-input releases and add its Source code (zip) URL (or a packaged
Functions
create(config?: { touch: Hash; }): OnscreenInstancereset(instance?: OnscreenInstance)register_button(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)on_input(action_id: Hash, action: {}, instance?: OnscreenInstance): boolean
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:{} | undefinedfn:(action: Hash, node: Opaque<"node">, touch: {}) => voidinstance?: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; } | undefinedfn:(action: Hash, node: Opaque<"node">, touch: {}) => voidinstance?:OnscreenInstance
on_input(action_id: Hash, action: {}, instance?: OnscreenInstance): boolean
Parameters
action_id:Hashaction:{}instance?:OnscreenInstance
Returns
boolean