A system for keeping track of input events and keeping key states available.

Static variables

staticread onlycaptureCtrlKeys:Array<Int> = [KeyCode.A,KeyCode.S,KeyCode.W]

Control key combinations to capture to prevent standard browser actions.

staticread onlycaptureKeys:Array<Int> = [KeyCode.LEFT,KeyCode.UP,KeyCode.RIGHT,KeyCode.DOWN,KeyCode.SPACE,KeyCode.FORWAD_SLASH]

Keys to capture to prevent standard browser actions.

staticread onlyfocused:Bool = true

Whether or not the game is currently focused for input.

statichideCursor:Bool = false

Whether or not to hide the cursor.

staticread onlymouseX:Float = 0

Current position of the mouse on the horizontal axis.

staticread onlymouseY:Float = 0

Current position of the mouse on the vertical axis.

staticonBlur:Void ‑> Void

Callback for after the game is no longer in focus.

staticonClick:Int ‑> Void

Callback for after a mouse button is pressed and then released over the game. Int passed is which button (0 = Unknown, 1 = Left, 2 = Middle, 3 = Right).

staticonFocus:Void ‑> Void

Callback for when the game is now in focus.

staticonMouseDown:Int ‑> Void

Callback for when a mouse button is pressed over the game. Int passed is which button (0 = Unknown, 1 = Left, 2 = Middle, 3 = Right).

staticonMouseMove:Void ‑> Void

Callback for when the mouse moves while over the game.

staticonMouseOut:Void ‑> Void

Callback for after the mouse is no longer over the game.

staticonMouseOver:Void ‑> Void

Callback for when the mouse is now over the game.

staticonMouseUp:Int ‑> Void

Callback for when a mouse button is released over the game. Int passed is which button (0 = Unknown, 1 = Left, 2 = Middle, 3 = Right).

Static methods

static_init (gameMouseDown:Int ‑> Void, gameMouseUp:Int ‑> Void):Void

Initializes the input event listeners. Note: Do not call directly.

static_update ():Void

Updates the system at the end of every frame. Note: Do not call directly!

statickeyDown (code:Int):Bool

Whether or not the provided key is currently down.

Parameters:

code

The key code to check.

statickeyPressed (code:Int):Bool

Whether or not the provided key was just pressed.

Parameters:

code

The key code to check.

statickeyReleased (code:Int):Bool

Whether or not the provided key was just released.

Parameters:

code

The key code to check.