Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

InputEventWithModifiers

Inherits: InputEventFromWindow < InputEvent < Resource < RefCounted < Object

Inherited By: InputEventGesture, InputEventKey, InputEventMouse

ShiftAlt 等修饰键影响的输入事件的抽象基类。

Description

存储鼠标、键盘、触摸手势等输入事件的相关信息。包括按下了哪些修饰键等信息,修饰键包括 ShiftAlt 等。见 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

BitField<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 ( )

Alt 修饰键的状态。


bool command_or_control_autoremap = false

  • void set_command_or_control_autoremap ( bool value )

  • bool is_command_or_control_autoremap ( )

Automatically use Meta (Cmd) 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 ( )

Ctrl 修饰键的状态。


bool meta_pressed = false

  • void set_meta_pressed ( bool value )

  • bool is_meta_pressed ( )

Meta 修饰键的状态。在 Windows 和 Linux 上代表 Windows 键(有时在 Linux 上称为“meta”或“super”键)。在 macOS 上代表 Command 键。


bool shift_pressed = false

  • void set_shift_pressed ( bool value )

  • bool is_shift_pressed ( )

Shift 修饰键的状态。


Method Descriptions

BitField<KeyModifierMask> get_modifiers_mask ( ) const

返回修饰键的键码组合。


bool is_command_or_control_pressed ( ) const

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

On other platforms, returns true if Ctrl is pressed.