Input
Variables
MODIFIER_KEYS
• 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
MOVEMENT_BUTTON_ACTIONS
• Const
MOVEMENT_BUTTON_ACTIONS: readonly [LEFT
, RIGHT
, UP
, DOWN
]
Defined in
packages/isaacscript-common/src/functions/input.ts:23
MOVEMENT_BUTTON_ACTIONS_SET
• Const
MOVEMENT_BUTTON_ACTIONS_SET: ReadonlySet
<ButtonAction
>
Defined in
packages/isaacscript-common/src/functions/input.ts:30
SHOOTING_BUTTON_ACTIONS
• Const
SHOOTING_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
• Const
SHOOTING_BUTTON_ACTIONS_SET: ReadonlySet
<ButtonAction
>
Defined in
packages/isaacscript-common/src/functions/input.ts:41
Functions
controllerToString
▸ controllerToString(controller
): string
| undefined
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
Name | Type |
---|---|
controller | Controller |
Returns
string
| undefined
Defined in
packages/isaacscript-common/src/functions/input.ts:51
getMoveButtonActions
▸ getMoveButtonActions(controllerIndex
): readonly ButtonAction
[]
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
Name | Type |
---|---|
controllerIndex | ControllerIndex |
Returns
readonly ButtonAction
[]
Defined in
packages/isaacscript-common/src/functions/input.ts:66
getShootButtonActions
▸ getShootButtonActions(controllerIndex
): readonly ButtonAction
[]
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
Name | Type |
---|---|
controllerIndex | ControllerIndex |
Returns
readonly ButtonAction
[]
Defined in
packages/isaacscript-common/src/functions/input.ts:79
isActionPressed
▸ isActionPressed(controllerIndex
, ...buttonActions
): boolean
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
Name | Type |
---|---|
controllerIndex | ControllerIndex |
...buttonActions | readonly ButtonAction [] |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:93
isActionPressedOnAnyInput
▸ isActionPressedOnAnyInput(...buttonActions
): boolean
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
Name | Type |
---|---|
...buttonActions | readonly ButtonAction [] |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:109
isActionTriggered
▸ isActionTriggered(controllerIndex
, ...buttonActions
): boolean
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
Name | Type |
---|---|
controllerIndex | ControllerIndex |
...buttonActions | readonly ButtonAction [] |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:125
isActionTriggeredOnAnyInput
▸ isActionTriggeredOnAnyInput(...buttonActions
): boolean
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
Name | Type |
---|---|
...buttonActions | readonly ButtonAction [] |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:141
isKeyboardPressed
▸ isKeyboardPressed(...keys
): boolean
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
Name | Type |
---|---|
...keys | readonly Keyboard [] |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:155
isModifierKeyPressed
▸ isModifierKeyPressed(): boolean
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
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:166
isMoveAction
▸ isMoveAction(buttonAction
): boolean
Parameters
Name | Type |
---|---|
buttonAction | ButtonAction |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:170
isMoveActionPressed
▸ isMoveActionPressed(controllerIndex
): boolean
Parameters
Name | Type |
---|---|
controllerIndex | ControllerIndex |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:174
isMoveActionPressedOnAnyInput
▸ isMoveActionPressedOnAnyInput(): boolean
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:178
isMoveActionTriggered
▸ isMoveActionTriggered(controllerIndex
): boolean
Parameters
Name | Type |
---|---|
controllerIndex | ControllerIndex |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:184
isMoveActionTriggeredOnAnyInput
▸ isMoveActionTriggeredOnAnyInput(): boolean
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:190
isShootAction
▸ isShootAction(buttonAction
): boolean
Parameters
Name | Type |
---|---|
buttonAction | ButtonAction |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:196
isShootActionPressed
▸ isShootActionPressed(controllerIndex
): boolean
Parameters
Name | Type |
---|---|
controllerIndex | ControllerIndex |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:200
isShootActionPressedOnAnyInput
▸ isShootActionPressedOnAnyInput(): boolean
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:206
isShootActionTriggered
▸ isShootActionTriggered(controllerIndex
): boolean
Parameters
Name | Type |
---|---|
controllerIndex | ControllerIndex |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:212
isShootActionTriggeredOnAnyInput
▸ isShootActionTriggeredOnAnyInput(): boolean
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/input.ts:218
keyboardToString
▸ keyboardToString(keyboard
, uppercase
): string
| undefined
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
Name | Type |
---|---|
keyboard | Keyboard |
uppercase | boolean |
Returns
string
| undefined