API Docs for: 3
Show:

InputDevice Class

Defined in: v3/p5play.js:6982

Look at the Input reference pages before reading these docs.

https://p5play.org/learn/input_devices.html

Root class for storing the state of inputs (mouse, keyboard, gamepads).

-3 means input was released after being held, pressed for 12 frames -2 means input was pressed and released on the same frame -1 means input was released 0 means input is not pressed 1 means input was pressed

1 means input is still being pressed 12 means input was held 12 means input is being held

Methods

dragging

(
  • inp
)
Number

Defined in v3/p5play.js:7181

Parameters:

  • inp String

Returns:

Number:

the amount of frames the user has been dragging the input

held

(
  • inp
)
Boolean

Defined in v3/p5play.js:7088

Parameters:

  • inp String

Returns:

Boolean:

true on the first frame that the user released a held input

holding

(
  • inp
)
Number

Defined in v3/p5play.js:7077

Parameters:

  • inp String

Returns:

Number:

the amount of frames the user has been holding the input

holds

(
  • inp
)
Boolean

Defined in v3/p5play.js:7066

Parameters:

  • inp String

Returns:

Boolean:

true on the first frame that the user holds the input

hovered

() Boolean

Defined in v3/p5play.js:7217

Returns:

Boolean:

true on the first frame that the mouse is no longer over the sprite

hovering

() Number

Defined in v3/p5play.js:7209

Returns:

Number:

the amount of frames the mouse has been over the sprite

hovers

() Boolean

Defined in v3/p5play.js:7201

Returns:

Boolean:

true on the first frame that the mouse is over the sprite

pressed

(
  • inp
)
Boolean

Defined in v3/p5play.js:7057

Parameters:

  • inp String

Returns:

Boolean:

true on the first frame that the user released the input

presses

(
  • inp
)
Boolean

Defined in v3/p5play.js:7034

Parameters:

  • inp String

Returns:

Boolean:

true on the first frame that the user presses the input

pressing

(
  • inp
)
Number

Defined in v3/p5play.js:7045

Parameters:

  • inp String

Returns:

Number:

the amount of frames the user has been pressing the input

released

(
  • inp
)
Boolean

Defined in v3/p5play.js:7099

Parameters:

  • inp String

Returns:

Boolean:

true on the first frame that the user released the input

Properties

holdThreshold

Number

Defined in v3/p5play.js:7003

The amount of frames an input must be pressed to be considered held. Default is 12.

pos

Unknown

Defined in v3/p5play.js:7158

The mouse's position.

position

Unknown

Defined in v3/p5play.js:7165

The mouse's position. Alias for pos.

x

Number

Defined in v3/p5play.js:7143

The mouse's x position.

y

Number

Defined in v3/p5play.js:7150

The mouse's y position.