InputManager

class InputManager(master: Drawable?, var keyBinder: KeyBinder?, settings: Settings)

InputManager

Handles input events and passes them to the correct components/layouts.

Parameters

master

the layout to create this event manager for. marked as internal as should not be accessed.

keyBinder

the key binder to use for this event manager. marked as internal as should not be accessed.

Constructors

Link copied to clipboard
constructor(master: Drawable?, keyBinder: KeyBinder?, settings: Settings)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "getKeyModifiers")
val keyModifiers: Modifiers
Link copied to clipboard
@ApiStatus.Internal
var mods: Byte

the current key modifiers (raw).

Link copied to clipboard

weather or not the left button/primary click is DOWN (aka repeating)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun addModifier(modifier: Byte)

add a modifier to the current keyModifiers.

Link copied to clipboard

Clear the current keyModifiers.

Link copied to clipboard
fun dispatch(event: Event, bindable: Boolean = false, to: Drawable? = mouseOver): Boolean

Dispatch an event to the provided drawable.

Link copied to clipboard
@ApiStatus.Internal
fun drop(it: Drawable? = null)

Drop the current mouse over drawable.

Link copied to clipboard
fun filesDropped(files: Array<Path>)

Call this method when files are dropped onto this window. The Event.Focused.FileDrop is then dispatched to the currently focused drawable.

Link copied to clipboard
fun focus(focusable: Drawable?): Boolean

Sets the focus to the specified focusable element, throwing an exception if the provided element is not focusable.

Link copied to clipboard
fun keyDown(code: Int)

This method should be called when a non-representable key is pressed.

fun keyDown(key: Keys)

This method should be called when a non-printable, but representable key is pressed.

Link copied to clipboard
fun keyTyped(key: Char)

This method should be called when a printable key is typed. This key should be mapped to the user's keyboard layout!

Link copied to clipboard
fun keyUp(code: Int)

This method should be called when a non-representable key is released.

fun keyUp(key: Keys)

This method should be called when a non-printable, but representable key is released.

Link copied to clipboard
fun mouseMoved(x: Float, y: Float)

call this function to update the mouse position.

Link copied to clipboard
fun mousePressed(button: Int)
Link copied to clipboard
fun mouseReleased(button: Int)

call this function when a mouse button is released.

Link copied to clipboard
fun mouseScrolled(amountX: Float, amountY: Float)

call this function when the mouse is scrolled.

Link copied to clipboard
@ApiStatus.Experimental
@Contract(pure = true)
fun rayCheck(it: Drawable, x: Float, y: Float): Drawable?

perform a recursive ray check on the drawable. Each drawable will be checked with Drawable.enabled, then Drawable.isInside, then finally Drawable.acceptsInput before it is considered a valid candidate.

Link copied to clipboard
@ApiStatus.Experimental
@Contract(pure = true)
fun rayCheckUnsafe(it: Drawable, x: Float, y: Float): Drawable?

same as rayCheck, but does not check for Drawable.acceptsInput.

Link copied to clipboard

force the mouse position to be updated.

Link copied to clipboard
fun removeModifier(modifier: Byte)

remove a modifier from the current keyModifiers.

Link copied to clipboard
fun safeFocus(drawable: Drawable?): Boolean

try to focus a drawable, without throwing an exception.

Link copied to clipboard
fun unfocus()
Link copied to clipboard
fun with(master: Drawable?): InputManager