Class in reactor_core_io.js

TouchInput

37 functions in 5 groups · hide internal

The Database: everything Core loads at boot.

Familiar territory. TouchInput keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.

The static class that handles input data from the mouse and touchscreen.

@namespace
function TouchInput()

Quick Reference

Setup & Creation 3

initialize() Initializes the touch system.
_createNewState() Creates the new state.
_setupEventHandlers() Setup event handlers.

Checks (True / False) 13

isClicked() Checks whether the mouse button or touchscreen has been pressed and released at the same position.
isPressed() Checks whether the mouse button or touchscreen is currently pressed down.
isTriggered() Checks whether the left mouse button or touchscreen is just pressed.
isRepeated() Checks whether the left mouse button or touchscreen is just pressed or a pseudo key repeat occurred.
isLongPressed() Checks whether the left mouse button or touchscreen is kept depressed.
isMouseButtonPressed() Checks the independent state of a mouse button.
isMouseButtonTriggered() Whether it is mouse button triggered.
isMouseButtonReleased() Whether it is mouse button released.
isMouseButtonLongPressed() Whether it is mouse button long pressed.
isCancelled() Checks whether the right mouse button is just pressed.
isMoved() Checks whether the mouse or a finger on the touchscreen is moved.
isHovered() Checks whether the mouse is moved without pressing a button.
isReleased() Checks whether the left mouse button or touchscreen is released.

Actions 1

clear() Clears all the touch data.

Events, Commands & Input 19

_onMouseDown() Called when mouse down happens.
_onLeftButtonDown() Called when left button down happens.
_onMiddleButtonDown() Called when middle button down happens.
_onRightButtonDown() Called when right button down happens.
_onMouseMove() Called when mouse move happens.
_onMouseUp() Called when mouse up happens.
_onMouseButtonTrigger() Called when mouse button trigger happens.
_onMouseButtonRelease() Called when mouse button release happens.
_onWheel() Called when wheel happens.
_onTouchStart() Called when touch start happens.
_onTouchMove() Called when touch move happens.
_onTouchEnd() Called when touch end happens.
_onTouchCancel() Called when touch cancel happens.
_onLostFocus() Called when lost focus happens.
_onTrigger() Called when trigger happens.
_onCancel() Called when cancel happens.
_onMove() Called when move happens.
_onHover() Called when hover happens.
_onRelease() Called when release happens.

Updating & Drawing 1

update() Updates the touch data.

Setup & Creation

initialize

static source
TouchInput.initialize()

Initializes the touch system.

_createNewState

static internal source
TouchInput._createNewState()

Creates the new state. (Same as the RPG Maker MZ method of this name.)

_setupEventHandlers

static internal source
TouchInput._setupEventHandlers()

Setup event handlers. (Same as the RPG Maker MZ method of this name.)

Checks (True / False)

isClicked

static source
TouchInput.isClicked()

Checks whether the mouse button or touchscreen has been pressed and released at the same position.

Details

Checks whether the mouse button or touchscreen has been pressed and released at the same position.

@returns
boolean True if the mouse button or touchscreen is clicked.

isPressed

static source
TouchInput.isPressed()

Checks whether the mouse button or touchscreen is currently pressed down.

Details

Checks whether the mouse button or touchscreen is currently pressed down.

@returns
boolean True if the mouse button or touchscreen is pressed.

isTriggered

static source
TouchInput.isTriggered()

Checks whether the left mouse button or touchscreen is just pressed.

Details

Checks whether the left mouse button or touchscreen is just pressed.

@returns
boolean True if the mouse button or touchscreen is triggered.

isRepeated

static source
TouchInput.isRepeated()

Checks whether the left mouse button or touchscreen is just pressed or a pseudo key repeat occurred.

Details

Checks whether the left mouse button or touchscreen is just pressed or a pseudo key repeat occurred.

@returns
boolean True if the mouse button or touchscreen is repeated.

isLongPressed

static source
TouchInput.isLongPressed()

Checks whether the left mouse button or touchscreen is kept depressed.

Details

Checks whether the left mouse button or touchscreen is kept depressed.

@returns
boolean True if the left mouse button or touchscreen is long-pressed.

isMouseButtonPressed

static source
TouchInput.isMouseButtonPressed(button)

Checks the independent state of a mouse button.

Details

Checks the independent state of a mouse button.

@param
button number 0=left, 1=middle, 2=right.
@returns
boolean True if the button is pressed.

isMouseButtonTriggered

static source
TouchInput.isMouseButtonTriggered(button)

Whether it is mouse button triggered. (Same as the RPG Maker MZ method of this name.)

isMouseButtonReleased

static source
TouchInput.isMouseButtonReleased(button)

Whether it is mouse button released. (Same as the RPG Maker MZ method of this name.)

isMouseButtonLongPressed

static source
TouchInput.isMouseButtonLongPressed(button)

Whether it is mouse button long pressed. (Same as the RPG Maker MZ method of this name.)

isCancelled

static source
TouchInput.isCancelled()

Checks whether the right mouse button is just pressed.

Details

Checks whether the right mouse button is just pressed.

@returns
boolean True if the right mouse button is just pressed.

isMoved

static source
TouchInput.isMoved()

Checks whether the mouse or a finger on the touchscreen is moved.

Details

Checks whether the mouse or a finger on the touchscreen is moved.

@returns
boolean True if the mouse or a finger on the touchscreen is moved.

isHovered

static source
TouchInput.isHovered()

Checks whether the mouse is moved without pressing a button.

Details

Checks whether the mouse is moved without pressing a button.

@returns
boolean True if the mouse is hovered.

isReleased

static source
TouchInput.isReleased()

Checks whether the left mouse button or touchscreen is released.

Details

Checks whether the left mouse button or touchscreen is released.

@returns
boolean True if the mouse button or touchscreen is released.

Actions

clear

static source
TouchInput.clear()

Clears all the touch data.

Events, Commands & Input

_onMouseDown

static internal source
TouchInput._onMouseDown(event)

Called when mouse down happens. (Same as the RPG Maker MZ method of this name.)

_onLeftButtonDown

static internal source
TouchInput._onLeftButtonDown(event)

Called when left button down happens. (Same as the RPG Maker MZ method of this name.)

_onMiddleButtonDown

static internal source
TouchInput._onMiddleButtonDown(event)

Called when middle button down happens. (Same as the RPG Maker MZ method of this name.)

_onRightButtonDown

static internal source
TouchInput._onRightButtonDown(event)

Called when right button down happens. (Same as the RPG Maker MZ method of this name.)

_onMouseMove

static internal source
TouchInput._onMouseMove(event)

Called when mouse move happens. (Same as the RPG Maker MZ method of this name.)

_onMouseUp

static internal source
TouchInput._onMouseUp(event)

Called when mouse up happens. (Same as the RPG Maker MZ method of this name.)

_onMouseButtonTrigger

static internal source
TouchInput._onMouseButtonTrigger(button)

Called when mouse button trigger happens. (Same as the RPG Maker MZ method of this name.)

_onMouseButtonRelease

static internal source
TouchInput._onMouseButtonRelease(button)

Called when mouse button release happens. (Same as the RPG Maker MZ method of this name.)

_onWheel

static internal source
TouchInput._onWheel(event)

Called when wheel happens. (Same as the RPG Maker MZ method of this name.)

_onTouchStart

static internal source
TouchInput._onTouchStart(event)

Called when touch start happens. (Same as the RPG Maker MZ method of this name.)

_onTouchMove

static internal source
TouchInput._onTouchMove(event)

Called when touch move happens. (Same as the RPG Maker MZ method of this name.)

_onTouchEnd

static internal source
TouchInput._onTouchEnd(event)

Called when touch end happens. (Same as the RPG Maker MZ method of this name.)

_onTouchCancel

static internal source
TouchInput._onTouchCancel(/*event*/)

Called when touch cancel happens. (Same as the RPG Maker MZ method of this name.)

_onLostFocus

static internal source
TouchInput._onLostFocus()

Called when lost focus happens. (Same as the RPG Maker MZ method of this name.)

_onTrigger

static internal source
TouchInput._onTrigger(x, y)

Called when trigger happens. (Same as the RPG Maker MZ method of this name.)

_onCancel

static internal source
TouchInput._onCancel(x, y)

Called when cancel happens. (Same as the RPG Maker MZ method of this name.)

_onMove

static internal source
TouchInput._onMove(x, y)

Called when move happens. (Same as the RPG Maker MZ method of this name.)

_onHover

static internal source
TouchInput._onHover(x, y)

Called when hover happens. (Same as the RPG Maker MZ method of this name.)

_onRelease

static internal source
TouchInput._onRelease(x, y)

Called when release happens. (Same as the RPG Maker MZ method of this name.)

Updating & Drawing

update

static source
TouchInput.update()

Updates the touch data.