Skip to content

Input

const MODIFIER_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


const MOVEMENT_BUTTON_ACTIONS: readonly [LEFT, RIGHT, UP, DOWN]

Defined in: packages/isaacscript-common/src/functions/input.ts:23


const MOVEMENT_BUTTON_ACTIONS_SET: ReadonlySet<ButtonAction>

Defined in: packages/isaacscript-common/src/functions/input.ts:30


const SHOOTING_BUTTON_ACTIONS: readonly [SHOOT_LEFT, SHOOT_RIGHT, SHOOT_UP, SHOOT_DOWN]

Defined in: packages/isaacscript-common/src/functions/input.ts:34


const SHOOTING_BUTTON_ACTIONS_SET: ReadonlySet<ButtonAction>

Defined in: packages/isaacscript-common/src/functions/input.ts:41

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.

Controller

string | undefined


getMoveButtonActions(controllerIndex): readonly ButtonAction[]

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.

ControllerIndex

readonly ButtonAction[]


getShootButtonActions(controllerIndex): readonly ButtonAction[]

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.

ControllerIndex

readonly ButtonAction[]


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.

ControllerIndex

…readonly ButtonAction[]

boolean


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.

…readonly ButtonAction[]

boolean


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.

ControllerIndex

…readonly ButtonAction[]

boolean


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.

…readonly ButtonAction[]

boolean


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.

…readonly Keyboard[]

boolean


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.

boolean


isMoveAction(buttonAction): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:170

ButtonAction

boolean


isMoveActionPressed(controllerIndex): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:174

ControllerIndex

boolean


isMoveActionPressedOnAnyInput(): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:178

boolean


isMoveActionTriggered(controllerIndex): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:184

ControllerIndex

boolean


isMoveActionTriggeredOnAnyInput(): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:190

boolean


isShootAction(buttonAction): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:196

ButtonAction

boolean


isShootActionPressed(controllerIndex): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:200

ControllerIndex

boolean


isShootActionPressedOnAnyInput(): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:206

boolean


isShootActionTriggered(controllerIndex): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:212

ControllerIndex

boolean


isShootActionTriggeredOnAnyInput(): boolean

Defined in: packages/isaacscript-common/src/functions/input.ts:218

boolean


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]).

Keyboard

boolean

string | undefined