KeyBinder

class KeyBinder(settings: Settings)

KeyBinder

KeyBinder handles key bindings for the PolyUI instance.

See also

Constructors

Link copied to clipboard
constructor(settings: Settings)

Types

Link copied to clipboard
open class Bind(val unmappedKeys: IntArray? = null, val keys: Array<Keys>? = null, val mouse: IntArray? = null, val mods: Modifiers = Modifiers(0), val durationNanos: Long = 0, val action: (Boolean) -> Boolean)

Properties

Link copied to clipboard

Property which enables an optimization where the KeyBinder will only update after every frame if there are time-sensitive listeners.

Functions

Link copied to clipboard
@ApiStatus.Internal
fun accept(event: Event, mods: Byte): Boolean

accept a keystroke event. This will call all keybindings that match the event.

@ApiStatus.Internal
fun accept(key: Int, down: Boolean, mods: Byte): Boolean

accept an unmapped keystroke event. This will call all keybindings that match the event.

Link copied to clipboard
fun add(vararg binds: KeyBinder.Bind)
fun add(bind: KeyBinder.Bind)

Add a keybind to this PolyUI instance, that will be run when the given keys are pressed.

Link copied to clipboard
@ApiStatus.Internal
fun cancelRecord(reason: String)
Link copied to clipboard
fun record(holdDurationNanos: Long = 0, callback: (KeyBinder.Bind?) -> Unit, function: (Boolean) -> Boolean)

Begin recording for a keybind. The resulting keybind, which will be passed to the callback, is not registered automatically.

Link copied to clipboard
@ApiStatus.Internal
fun release()

Synthetically drop all pressed keys

Link copied to clipboard
fun remove(vararg binds: KeyBinder.Bind)
Link copied to clipboard
@ApiStatus.Internal
fun update(deltaTimeNanos: Long, mods: Byte, down: Boolean): Boolean