Class in reactor_core_io.js

Input

21 functions in 6 groups · hide internal

The Database: everything Core loads at boot.

Familiar territory. Input 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 keyboard and gamepads.

@namespace
function Input()

Quick Reference

Setup & Creation 3

initialize() Initializes the input system.
_setupEventHandlers() Setup event handlers.
_makeNumpadDirection() Makes the numpad direction.

Checks (True / False) 7

isPressed() Checks whether a key is currently pressed down.
isTriggered() Checks whether a key is just pressed.
isReleased() Checks whether a key was released during the latest update.
isRepeated() Checks whether a key is just pressed or a key repeat occurred.
isLongPressed() Checks whether a key is kept depressed.
_shouldPreventDefault() Whether it should prevent default.
_isEscapeCompatible() Whether it is escape compatible.

Actions 1

clear() Clears all the input data.

Events, Commands & Input 3

_onKeyDown() Called when key down happens.
_onKeyUp() Called when key up happens.
_onLostFocus() Called when lost focus happens.

Updating & Drawing 3

update() Updates the input data.
_updateGamepadState() Updates the gamepad state each frame.
_updateDirection() Updates the direction each frame.

Other 4

virtualClick() Virtual click.
_pollGamepads() Poll gamepads.
_signX() Sign x.
_signY() Sign y.

Setup & Creation

initialize

static source
Input.initialize()

Initializes the input system.

_setupEventHandlers

static internal source
Input._setupEventHandlers()

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

_makeNumpadDirection

static internal source
Input._makeNumpadDirection(x, y)

Makes the numpad direction. (Same as the RPG Maker MZ method of this name.)

Checks (True / False)

isPressed

static source
Input.isPressed(keyName)

Checks whether a key is currently pressed down.

Details

Checks whether a key is currently pressed down.

@param
keyName string The mapped name of the key.
@returns
boolean True if the key is pressed.

isTriggered

static source
Input.isTriggered(keyName)

Checks whether a key is just pressed.

Details

Checks whether a key is just pressed.

@param
keyName string The mapped name of the key.
@returns
boolean True if the key is triggered.

isReleased

static source
Input.isReleased(keyName)

Checks whether a key was released during the latest update.

Details

Checks whether a key was released during the latest update.

@param
keyName string The mapped name of the key.
@returns
boolean True if the key was released.

isRepeated

static source
Input.isRepeated(keyName)

Checks whether a key is just pressed or a key repeat occurred.

Details

Checks whether a key is just pressed or a key repeat occurred.

@param
keyName string The mapped name of the key.
@returns
boolean True if the key is repeated.

isLongPressed

static source
Input.isLongPressed(keyName)

Checks whether a key is kept depressed.

Details

Checks whether a key is kept depressed.

@param
keyName string The mapped name of the key.
@returns
boolean True if the key is long-pressed.

_shouldPreventDefault

static internal source
Input._shouldPreventDefault(keyCode)

Whether it should prevent default. (Same as the RPG Maker MZ method of this name.)

_isEscapeCompatible

static internal source
Input._isEscapeCompatible(keyName)

Whether it is escape compatible. (Same as the RPG Maker MZ method of this name.)

Actions

clear

static source
Input.clear()

Clears all the input data.

Events, Commands & Input

_onKeyDown

static internal source
Input._onKeyDown(event)

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

_onKeyUp

static internal source
Input._onKeyUp(event)

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

_onLostFocus

static internal source
Input._onLostFocus()

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

Updating & Drawing

update

static source
Input.update()

Updates the input data.

_updateGamepadState

static internal source
Input._updateGamepadState(gamepad)

Updates the gamepad state each frame. (Same as the RPG Maker MZ method of this name.)

_updateDirection

static internal source
Input._updateDirection()

Updates the direction each frame. (Same as the RPG Maker MZ method of this name.)

Other

virtualClick

static source
Input.virtualClick(buttonName)

Virtual click. (Same as the RPG Maker MZ method of this name.)

_pollGamepads

static internal source
Input._pollGamepads()

Poll gamepads. (Same as the RPG Maker MZ method of this name.)

_signX

static internal source
Input._signX()

Sign x. (Same as the RPG Maker MZ method of this name.)

_signY

static internal source
Input._signY()

Sign y. (Same as the RPG Maker MZ method of this name.)