API Docs for: 1.4.0
Show:

Kiwi.Input.Pointer Class

Module: Input
Parent Module: Kiwi

Is a generic class that holds the properties/methods that are common across various different methods of inputs from the user, mainly between Touch and Mouse based events. This abstract class and such it is suppose to be extended from for individual implementations.

Constructor

Kiwi.Input.Pointer

(
  • game
)
Kiwi.Input.Pointer

Parameters:

Returns:

Methods

justPressed

(
  • duration
)
public

Indicates if the pointer was just pressed. This is based of the justPressedRate unless otherwise specifieds.

Parameters:

  • duration Number

Returns:

boolean

justReleased

(
  • duration
)
public

Indicates if the pointer was just released. This is based of the justReleasedRate unless otherwise specified.

Parameters:

  • duration Number

Returns:

boolean

move

(
  • event
)
public

Used to get the cooridnates of a pointer and inputs them to the correct properties.

Parameters:

  • event Event

objType

() String public

The type of object this class is.

Returns:

String:

"Pointer"

reset

() public

Resets the pointer properties to the default ones. Assumes that the pointer is no longer down.

start

(
  • event
)
public

The method that gets executed when the pointer presses/initially goes down on the screen. From the event passed the coordinates are calculated.

Parameters:

  • event Event

stop

(
  • event
)
public

The stop method is to be called when the pointer gets released initially.

Parameters:

  • event Event

update

() public

The update loop for the pointer. Used only if down to update the duration.

Properties

_game

Game private

The game that this pointer belongs to.

_id

Number private

The unique identifier for this pointer.

active

Boolean public

Indicates if this pointer is active. Note a mouse is always 'active' where as a finger is only active when it is down.

Default: false

circle

Kiwi.Geom.Circle public

A circle that is representative of the area this point covers.

clientX

Number public

The horizontal coordinate of point relative to the viewport in pixels, excluding any scroll offset

Default: -1

clientY

Number public

The vertical coordinate of point relative to the viewport in pixels, excluding any scroll offset

Default: -1

duration

Number public

The duration that the pointer has been down for in milliseconds.

Default: 0

endPoint

Kiwi.Geom.Point public

The coordinates where the user released the pointer.

frameDuration

Number public

The duration that the pointer has been down for in frames.

Default: 0

isDown

Boolean public

Indicates if this pointer is currently down.

Default: false

isUp

Boolean public

Indicates if this pointer is currently up.

Default: true

justPressedRate

Number public

A time that is used to calculate if someone justPressed the pointer.

justReleasedRate

Number public

A time that is used to calculate if someone justReleased the pointer.

Default: 200

pageX

Number public

The horizontal coordinate of point relative to the viewport in pixels, including any scroll offset

Default: -1

pageY

Number public

The vertical coordinate of point relative to the viewport in pixels, including any scroll offset

Default: -1

point

Kiwi.Geom.Point public

The point that this pointer is at. Same coordinates as X/Y properties.

pressed

Boolean public

READ ONLY: Indicates if this pointer was pressed on the last frame or not. This is only true on the frame that the point was 'justPressed' and is not a constant like 'isDown'

released

Boolean public

READ ONLY: Indicates if this pointer was released on the last frame or not. This is only true on the frame that the point was 'justReleased' and is not a constant like 'isUp'

screenX

Number public

The horizontal coordinate of point relative to the screen in pixels

Default: -1

screenY

Number public

The vertical coordinate of point relative to the screen in pixels

Default: -1

startPoint

Kiwi.Geom.Point public

The points inital coordinates when pressed down.

timeDown

Number public

Indicates the time that the pointer was pressed initially.

Default: 0

timeUp

Number public

Indicates the time that the pointer was released initially.

Default: 0

withinGame

Boolean public

Indicates if this pointer is currently within the game.

Default: false

x

Number public

The horizontal coordinate of point relative to the game element

Default: -1

y

Number public

The vertical coordinate of point relative to the game element

Default: -1