Basics
Guides
API Reference
Basics
Guides
API Reference
[25:7] extends: FxObj
Wraps FXGL's KeyInputBuilder
(com.almasb.fxgl.dsl.KeyInputBuilder), the fluent setup for
binding a key (optionally with a modifier and virtual button)
to an Aussom callback set. Construct via one of the
fxgl.onKeyBuilder(...) factory overloads — the underlying
UserAction is registered with the active Input service in
the builder's constructor.
Wiring:
wKey = aji.getStaticMember("javafx.scene.input.KeyCode", "W");
fxgl.onKeyBuilder(wKey)
.onActionBegin(::startMoving)
.onAction(::keepMoving)
.onActionEnd(::stopMoving);
KeyInputBuilder (Ajo = null)
Wraps an existing KeyInputBuilder AussomJavaObject (the usual entry, since
fxgl.onKeyBuilder(...)returns a wrapper with the AJO already populated). The factory methods register the underlying UserAction with the supplied Input service in the Kotlin constructor, so there is no Aussom-side no-arg ctor that would build a standalone instance.
Ajo is an optional AussomJavaObject around a KeyInputBuilder.adopt (object Ajo)
Wraps an existing KeyInputBuilder AussomJavaObject.
onActionBegin (callback Cb)
Sets the once-on-press handler.
Cb is a callback () -> void.onAction (callback Cb)
Sets the held-down handler (fires every tick the key is down).
Cb is a callback () -> void.onActionEnd (callback Cb)
Sets the once-on-release handler.
Cb is a callback () -> void.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.