Attention

You are reading the latest (unstable) version of this documentation, which may document features not available or compatible with Godot 3.x.

Work in progress

Godot documentation is being updated to reflect the latest changes in version 4.0. Some documentation pages may still state outdated information. This banner will tell you if you're reading one of such pages.

The contents of this page are up to date. If you can still find outdated information, please open an issue.

InputEventWithModifiers

Inherits: InputEventFromWindow < InputEvent < Resource < RefCounted < Object

Inherited By: InputEventGesture, InputEventKey, InputEventMouse

Base class for keys events with modifiers.

Description

Contains keys events information with modifiers support like Shift or Alt. See Node._input.

Tutorials

Properties

bool

alt_pressed

false

bool

command_or_control_autoremap

false

bool

ctrl_pressed

false

bool

meta_pressed

false

bool

shift_pressed

false

Methods

KeyModifierMask

get_modifiers_mask ( ) const

bool

is_command_or_control_pressed ( ) const


Property Descriptions

bool alt_pressed = false

  • void set_alt_pressed ( bool value )

  • bool is_alt_pressed ( )

State of the Alt modifier.


bool command_or_control_autoremap = false

  • void set_command_or_control_autoremap ( bool value )

  • bool is_command_or_control_autoremap ( )

Automatically use Meta (Command) on macOS and Ctrl on other platforms. If true, ctrl_pressed and meta_pressed cannot be set.


bool ctrl_pressed = false

  • void set_ctrl_pressed ( bool value )

  • bool is_ctrl_pressed ( )

State of the Ctrl modifier.


bool meta_pressed = false

  • void set_meta_pressed ( bool value )

  • bool is_meta_pressed ( )

State of the Meta modifier. On Windows and Linux, this represents the Windows key (sometimes called "meta" or "super" on Linux). On macOS, this represents the Command key.


bool shift_pressed = false

  • void set_shift_pressed ( bool value )

  • bool is_shift_pressed ( )

State of the Shift modifier.


Method Descriptions

KeyModifierMask get_modifiers_mask ( ) const

Returns the keycode combination of modifier keys.


bool is_command_or_control_pressed ( ) const

On macOS, returns true if Meta (Command) is pressed.

On other platforms, returns true if Ctrl is pressed.