Input

object Input

Input A utility class for generating input to the canvas and retrieving information from the canvas.

Functions

blocking
Link copied to clipboard
fun blocking(): Boolean

Whether or not user input is being relayed to the client instance.

fun blocking(b: Boolean)

Sets whether or not to block user input from being relayed to the client instance.

drag
Link copied to clipboard
fun drag(start: Point, dest: Point): Boolean

Holds down the left or right button, and drags the mouse to the specified location.

fun drag(x1: Int, y1: Int, x2: Int, y2: Int): Boolean
dragUntil
Link copied to clipboard
fun dragUntil(startX: Int, startY: Int, minY: Int, maxY: Int, yIncrement: Int, until: () -> Boolean): Boolean
inputBounds
Link copied to clipboard
fun inputBounds(): Rectangle
inputDimensions
Link copied to clipboard
fun inputDimensions(): Dimension
isTargetInViewport
Link copied to clipboard
fun isTargetInViewport(target: Point): Boolean
keyboard
Link copied to clipboard
fun keyboard(): Boolean

Whether or not keyboard events are allowed.

fun keyboard(b: Boolean)

Allow keyboard events to be relayed regardless of .blocking.

press
Link copied to clipboard
fun press(p: Point): Boolean
fun press(x: Int, y: Int): Boolean

Simulates the specified mouse button being pressed.

pressKey
Link copied to clipboard
fun pressKey(keyCode: Int)
release
Link copied to clipboard
fun release(p: Point): Boolean
fun release(x: Int, y: Int): Boolean

Simulates the specified mouse button being released.

releaseKey
Link copied to clipboard
fun releaseKey(keyCode: Int)
send
Link copied to clipboard
fun send(s: String): Boolean

Sends keys to the client, represented in a String, and a new-line at the end. Unicode commands are acceptable input, for example, \t

sendln
Link copied to clipboard
fun sendln(s: String): Boolean

Sends keys to the client, represented in a String, and a new-line at the end. Unicode commands are acceptable input, for example, \t

speed
Link copied to clipboard
fun speed(): Int

Returns the current mouse speed.

fun speed(s: Int): Int

Set the relative speed for mouse movements. This is a sensitive function and should be used in exceptional circumstances for a short period of time only.

tap
Link copied to clipboard
fun tap(point: Point, durationMs: Int = 0, getPoint: Callable<Point> = Callable { Point.Nil }): Boolean
fun tap(x: Int, y: Int, durationMs: Int = 0, getPoint: Callable<Point> = Callable { Point.Nil }): Boolean

Simulates the mouse clicking the specified button at the specified location.

Properties

blocking
Link copied to clipboard
val blocking: AtomicBoolean
keyboard
Link copied to clipboard
val keyboard: AtomicBoolean
KEYCODE_BACKSPACE
Link copied to clipboard
const val KEYCODE_BACKSPACE: Int
KEYCODE_SHIFT
Link copied to clipboard
const val KEYCODE_SHIFT: Int
MAXIMUM_SPEED
Link copied to clipboard
const val MAXIMUM_SPEED: Int = 100
MINIMUM_SPEED
Link copied to clipboard
const val MINIMUM_SPEED: Int = 1