API Docs for: 1.4.0
Show:

Kiwi.Input.InputManager Class

Module: Input
Parent Module: Kiwi

Handles the initialization and management of the various ways a user can interact with the device/game, whether this is through a Keyboard and Mouse or by a Touch. Also contains some of the general callbacks that are 'global' between both Desktop and Mobile based devices.

Constructor

Kiwi.Input.InputManager

(
  • game
)
Kiwi.Input.InputManager

Parameters:

  • game Kiwi.Game

    The game that this object belongs to.

Returns:

Kiwi.Input.InputManager:

This object.

Methods

_onDownEvent

(
  • x
  • y
  • timeDown
  • timeUp
  • duration
  • pointer
)
private

A private method that gets dispatched when either the mouse or touch manager dispatches a down event

Parameters:

  • x Number

    The x coordinate of the pointer

  • y Number

    The y coordinate of the pointer

  • timeDown Number

    The time that the pointer has been down for.

  • timeUp Number

    The Time that the pointer has been up form

  • duration Number
  • pointer Kiwi.Input.Pointer

    The pointer that was used.

_onUpEvent

(
  • x
  • y
  • timeDown
  • timeUp
  • duration
  • pointer
)
private

A private method that gets dispatched when either the mouse or touch manager dispatches a up event

Parameters:

  • x Number

    The x coordinate of the pointer

  • y Number

    The y coordinate of the pointer

  • timeDown Number

    The time that the pointer has been down for.

  • timeUp Number

    The Time that the pointer has been up form

  • duration Number
  • pointer Kiwi.Input.Pointer

    The pointer that was used.

boot

() public

This method is executed when the DOM has loaded and the manager is ready to load.

objType

() String public

The type of object this is.

Returns:

String:

"InputManager"

reset

()

Runs the reset method on the managers.

update

() public

The update loop that gets executed every frame.

Properties

_pointers

Array private

An array containing all of the pointers that are active on the stage.

game

Game public

The game that this manager belongs to.

isDown

Boolean public

If an input (either touch or the mouse cursor) is currently down. Not an accurate representation, should use the individual managers.

keyboard

Keyboard public

The keyboard manager

mouse

Mouse public

A reference to the mouse manager.

onDown

Signal public

A Signal that dispatches a event when any Pointer is pressed from the game.

onReleased

Signal public

An alias for the onRelease signal that goes straight to the onUp

onUp

Signal public

A Signal that dispatches a event when any Pointer is released from the game.

pointers

Array public

Returns all of the pointers that can be used on the Input Manager. This is READ only.

position

Kiwi.Geom.Point public

The position of the last pointer that was/is active on the stage.

touch

Touch public

The touch manager.

x

Number public

Populated x coordinate based on the most recent click/touch event

y

Number public

Populated y coordinate based on the most recent click/touch event