API Documentation

for 0.0.1
Show:

Pointer Class

Pointer is an abstraction that enables various input devices to send the same kind of events. It is designed to accumulate various type of inputs in a Map of PointerOject. Each input device is converted in a PointerOject in order to unify its interface. Usefully mainly internally for interactive UI objects like buttons.

Constructor

Pointer

(
  • params
)

Parameters:

  • params Object

    Parameters Object

    • components Component

      the input components to add to this pointer (i.e. Mouse)

Example:

//TODO

Methods

add

(
  • component
)

Adds the specified input component as a PointerObject to the pointers list.

Parameters:

get

(
  • component
)
Component

Returns the specified PointerObject to work with its state

Parameters:

Returns:

Component:

the corresponding input Component

getDeltaX

() Number

Returns x delta coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Returns:

Number:

coordinate

getDeltaY

() Number

Returns y delta coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Returns:

Number:

coordinate

getPointersArray

() Array

Returns an Array from the pointers Map object. For debug purpose.

Returns:

Array:

Pointers array

getState

() Array

Returns true if ANY of the PointerObjects (input Component) state is true, false otherwise. i.e. if you add a mouse and a touch component to the pointer, this will return true if any of these 2 has it's state to true.

Returns:

Array:

pointers array

getX

() Number

Returns x coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Returns:

Number:

x coordinate

getY

() Number

Returns y coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Returns:

Number:

y coordinate

postUpdate

()

Remove unused Pointers