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.
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 sourceInput.initialize()
Initializes the input system.
_setupEventHandlers
static internal sourceInput._setupEventHandlers()
Setup event handlers. (Same as the RPG Maker MZ method of this name.)
_makeNumpadDirection
static internal sourceInput._makeNumpadDirection(x, y)
Makes the numpad direction. (Same as the RPG Maker MZ method of this name.)
Checks (True / False)
isPressed
static sourceInput.isPressed(keyName)
Checks whether a key is currently pressed down.
Details
Checks whether a key is currently pressed down.
isTriggered
static sourceInput.isTriggered(keyName)
Checks whether a key is just pressed.
Details
Checks whether a key is just pressed.
isReleased
static sourceInput.isReleased(keyName)
Checks whether a key was released during the latest update.
Details
Checks whether a key was released during the latest update.
isRepeated
static sourceInput.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.
isLongPressed
static sourceInput.isLongPressed(keyName)
Checks whether a key is kept depressed.
Details
Checks whether a key is kept depressed.
_shouldPreventDefault
static internal sourceInput._shouldPreventDefault(keyCode)
Whether it should prevent default. (Same as the RPG Maker MZ method of this name.)
_isEscapeCompatible
static internal sourceInput._isEscapeCompatible(keyName)
Whether it is escape compatible. (Same as the RPG Maker MZ method of this name.)
Actions
clear
static sourceInput.clear()
Clears all the input data.
Events, Commands & Input
_onKeyDown
static internal sourceInput._onKeyDown(event)
Called when key down happens. (Same as the RPG Maker MZ method of this name.)
_onKeyUp
static internal sourceInput._onKeyUp(event)
Called when key up happens. (Same as the RPG Maker MZ method of this name.)
_onLostFocus
static internal sourceInput._onLostFocus()
Called when lost focus happens. (Same as the RPG Maker MZ method of this name.)
Updating & Drawing
update
static sourceInput.update()
Updates the input data.
_updateGamepadState
static internal sourceInput._updateGamepadState(gamepad)
Updates the gamepad state each frame. (Same as the RPG Maker MZ method of this name.)
_updateDirection
static internal sourceInput._updateDirection()
Updates the direction each frame. (Same as the RPG Maker MZ method of this name.)
Other
virtualClick
static sourceInput.virtualClick(buttonName)
Virtual click. (Same as the RPG Maker MZ method of this name.)
_pollGamepads
static internal sourceInput._pollGamepads()
Poll gamepads. (Same as the RPG Maker MZ method of this name.)
_signX
static internal sourceInput._signX()
Sign x. (Same as the RPG Maker MZ method of this name.)
_signY
static internal sourceInput._signY()
Sign y. (Same as the RPG Maker MZ method of this name.)