Fork me on GitHub
View source

package com.haxepunk.utils

class Input

Manage the different inputs.

Static variables

static read only joysticks : Int

Returns the number of connected joysticks

View source

static keyString : String

Contains the string of the last keys pressed

static lastKey : Int

Holds the last key pressed

static middleMouseDown : Bool

If the middle button mouse is held down. Not available in html5.

static middleMousePressed : Bool

If the middle button mouse was recently pressed. Not available in html5.

static middleMouseReleased : Bool

If the middle button mouse was recently released. Not available in html5.

static middleMouseUp : Bool

If the middle button mouse is up. Not available in html5.

static mouseDown : Bool

If the left button mouse is held down

static read only mouseFlashX : Int

The absolute mouse x position on the screen (unscaled).

static read only mouseFlashY : Int

The absolute mouse y position on the screen (unscaled).

static mousePressed : Bool

If the left button mouse was recently pressed

static mouseReleased : Bool

If the left button mouse was recently released

static mouseUp : Bool

If the left button mouse is up

static mouseWheel : Bool

If the mouse wheel has moved

static read only mouseWheelDelta : Int

If the mouse wheel was moved this frame, this was the delta.

static read only mouseX : Int

X position of the mouse on the screen.

static read only mouseY : Int

Y position of the mouse on the screen.

View source

static read only multiTouchSupported : Bool

Returns true if the device supports multi touch

static rightMouseDown : Bool

If the right button mouse is held down. Not available in html5.

static rightMousePressed : Bool

If the right button mouse was recently pressed. Not available in html5.

static rightMouseReleased : Bool

If the right button mouse was recently released. Not available in html5.

static rightMouseUp : Bool

If the right button mouse is up. Not available in html5.

static read only touchOrder : Array<Int>

static read only touches : Map<Int, Touch>

Static functions

View source

static check (input : InputType) : Bool

If the input or key is held down.


Parameters:
input   

An input name or key to check for.


Returns:

True or false.

View source

static define (name : String, keys : Array<Int>) : Void

Defines a new input.


Parameters:
name   

String to map the input to.

keys   

The keys to use for the Input.

View source

static hideCursor () : Void

Hides the native cursor

View source

static joystick (id : Int) : Joystick

Returns a joystick object (creates one if not connected)


Parameters:
id   

The id of the joystick, starting with 0


Returns:

A Joystick object

View source

static pressed (input : InputType) : Bool

If the input or key was pressed this frame.


Parameters:
input   

An input name or key to check for.


Returns:

True or false.

View source

static released (input : InputType) : Bool

If the input or key was released this frame.


Parameters:
input   

An input name or key to check for.


Returns:

True or false.

View source

static showCursor () : Void

Shows the native cursor

View source

static touchPoints (touchCallback : Touch ->Void, ) : Void