Input
Variables
Section titled “Variables”MODIFIER_KEYS
Section titled “MODIFIER_KEYS”
constMODIFIER_KEYS: readonly [LEFT_SHIFT,LEFT_CONTROL,LEFT_ALT,LEFT_SUPER,RIGHT_SHIFT,RIGHT_CONTROL,RIGHT_ALT,RIGHT_SUPER]
Defined in: packages/isaacscript-common/src/functions/input.ts:12
MOVEMENT_BUTTON_ACTIONS
Section titled “MOVEMENT_BUTTON_ACTIONS”
constMOVEMENT_BUTTON_ACTIONS: readonly [LEFT,RIGHT,UP,DOWN]
Defined in: packages/isaacscript-common/src/functions/input.ts:23
MOVEMENT_BUTTON_ACTIONS_SET
Section titled “MOVEMENT_BUTTON_ACTIONS_SET”
constMOVEMENT_BUTTON_ACTIONS_SET:ReadonlySet<ButtonAction>
Defined in: packages/isaacscript-common/src/functions/input.ts:30
SHOOTING_BUTTON_ACTIONS
Section titled “SHOOTING_BUTTON_ACTIONS”
constSHOOTING_BUTTON_ACTIONS: readonly [SHOOT_LEFT,SHOOT_RIGHT,SHOOT_UP,SHOOT_DOWN]
Defined in: packages/isaacscript-common/src/functions/input.ts:34
SHOOTING_BUTTON_ACTIONS_SET
Section titled “SHOOTING_BUTTON_ACTIONS_SET”
constSHOOTING_BUTTON_ACTIONS_SET:ReadonlySet<ButtonAction>
Defined in: packages/isaacscript-common/src/functions/input.ts:41
Functions
Section titled “Functions”controllerToString()
Section titled “controllerToString()”controllerToString(
controller):string|undefined
Defined in: packages/isaacscript-common/src/functions/input.ts:51
Helper function to get the enum name for the specified Controller value. Note that this will
trim off the “BUTTON_” prefix.
Returns undefined if the submitted controller value was not valid.
Parameters
Section titled “Parameters”controller
Section titled “controller”Controller
Returns
Section titled “Returns”string | undefined
getMoveButtonActions()
Section titled “getMoveButtonActions()”getMoveButtonActions(
controllerIndex): readonlyButtonAction[]
Defined in: packages/isaacscript-common/src/functions/input.ts:66
Helper function to get the movement actions that the specified ControllerIndex is currently
pressing down. This returns an array because a player can be holding down more than one movement
key at a time.
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”readonly ButtonAction[]
getShootButtonActions()
Section titled “getShootButtonActions()”getShootButtonActions(
controllerIndex): readonlyButtonAction[]
Defined in: packages/isaacscript-common/src/functions/input.ts:79
Helper function to get the shooting actions that the specified ControllerIndex is currently
pressing down. This returns an array because a player can be holding down more than one shooting
key at a time.
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”readonly ButtonAction[]
isActionPressed()
Section titled “isActionPressed()”isActionPressed(
controllerIndex, …buttonActions):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:93
Helper function to check if a player is pressing a specific button (i.e. holding it down).
This is a variadic version of Input.IsActionPressed, meaning that you can pass as many buttons
as you want to check for. This function will return true if any of the buttons are pressed.
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
buttonActions
Section titled “buttonActions”…readonly ButtonAction[]
Returns
Section titled “Returns”boolean
isActionPressedOnAnyInput()
Section titled “isActionPressedOnAnyInput()”isActionPressedOnAnyInput(…
buttonActions):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:109
Helper function to iterate over all inputs to determine if a specific button is pressed (i.e. being held down).
This function is variadic, meaning you can pass as many buttons as you want to check for. This function will return true if any of the buttons are pressed.
Parameters
Section titled “Parameters”buttonActions
Section titled “buttonActions”…readonly ButtonAction[]
Returns
Section titled “Returns”boolean
isActionTriggered()
Section titled “isActionTriggered()”isActionTriggered(
controllerIndex, …buttonActions):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:125
Helper function to check if a player is triggering a specific button (i.e. pressing and releasing it).
This is a variadic version of Input.IsActionTriggered, meaning that you can pass as many
buttons as you want to check for. This function will return true if any of the buttons are
triggered.
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
buttonActions
Section titled “buttonActions”…readonly ButtonAction[]
Returns
Section titled “Returns”boolean
isActionTriggeredOnAnyInput()
Section titled “isActionTriggeredOnAnyInput()”isActionTriggeredOnAnyInput(…
buttonActions):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:141
Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then released).
This function is variadic, meaning you can pass as many buttons as you want to check for. This function will return true if any of the buttons are pressed.
Parameters
Section titled “Parameters”buttonActions
Section titled “buttonActions”…readonly ButtonAction[]
Returns
Section titled “Returns”boolean
isKeyboardPressed()
Section titled “isKeyboardPressed()”isKeyboardPressed(…
keys):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:155
Helper function to see if a specific keyboard key is being held down by the player.
This function is variadic, meaning you can pass as many keyboard values as you want to check for. This function will return true if any of the values are pressed.
Parameters
Section titled “Parameters”…readonly Keyboard[]
Returns
Section titled “Returns”boolean
isModifierKeyPressed()
Section titled “isModifierKeyPressed()”isModifierKeyPressed():
boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:166
Helper function to check if one or more modifier keys are being pressed down on the keyboard.
A modifier key is defined as shift, control, alt, or Windows.
Returns
Section titled “Returns”boolean
isMoveAction()
Section titled “isMoveAction()”isMoveAction(
buttonAction):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:170
Parameters
Section titled “Parameters”buttonAction
Section titled “buttonAction”ButtonAction
Returns
Section titled “Returns”boolean
isMoveActionPressed()
Section titled “isMoveActionPressed()”isMoveActionPressed(
controllerIndex):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:174
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”boolean
isMoveActionPressedOnAnyInput()
Section titled “isMoveActionPressedOnAnyInput()”isMoveActionPressedOnAnyInput():
boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:178
Returns
Section titled “Returns”boolean
isMoveActionTriggered()
Section titled “isMoveActionTriggered()”isMoveActionTriggered(
controllerIndex):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:184
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”boolean
isMoveActionTriggeredOnAnyInput()
Section titled “isMoveActionTriggeredOnAnyInput()”isMoveActionTriggeredOnAnyInput():
boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:190
Returns
Section titled “Returns”boolean
isShootAction()
Section titled “isShootAction()”isShootAction(
buttonAction):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:196
Parameters
Section titled “Parameters”buttonAction
Section titled “buttonAction”ButtonAction
Returns
Section titled “Returns”boolean
isShootActionPressed()
Section titled “isShootActionPressed()”isShootActionPressed(
controllerIndex):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:200
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”boolean
isShootActionPressedOnAnyInput()
Section titled “isShootActionPressedOnAnyInput()”isShootActionPressedOnAnyInput():
boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:206
Returns
Section titled “Returns”boolean
isShootActionTriggered()
Section titled “isShootActionTriggered()”isShootActionTriggered(
controllerIndex):boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:212
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”boolean
isShootActionTriggeredOnAnyInput()
Section titled “isShootActionTriggeredOnAnyInput()”isShootActionTriggeredOnAnyInput():
boolean
Defined in: packages/isaacscript-common/src/functions/input.ts:218
Returns
Section titled “Returns”boolean
keyboardToString()
Section titled “keyboardToString()”keyboardToString(
keyboard,uppercase):string|undefined
Defined in: packages/isaacscript-common/src/functions/input.ts:232
Helper function to get the string that would be typed if someone pressed the corresponding key. This is useful for creating in-game chat.
Note that this function will only work for the keyboard values that are printable. Thus, it will
return undefined for e.g. Keyboard.LEFT_SHIFT (340). If all you want is the corresponding name
of the key, then simply use the enum reverse mapping (e.g. Keyboard[keyboard]).
Parameters
Section titled “Parameters”keyboard
Section titled “keyboard”Keyboard
uppercase
Section titled “uppercase”boolean
Returns
Section titled “Returns”string | undefined
