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

繼承: InputEventFromWindow < InputEvent < Resource < RefCounted < Object

被繼承: InputEventGesture, InputEventKey, InputEventMouse

ShiftAlt 等修飾鍵影響的輸入事件的抽象基底類別。

說明

Stores information about mouse, keyboard, and touch gesture input events. This includes information about which modifier keys are pressed, such as Shift or Alt. See Node._input().

Note: Modifier keys are considered modifiers only when used in combination with another key. As a result, their corresponding member variables, such as ctrl_pressed, will return false if the key is pressed on its own.

教學

屬性

bool

alt_pressed

false

bool

command_or_control_autoremap

false

bool

ctrl_pressed

false

int

device

16 (overrides InputEvent)

bool

meta_pressed

false

bool

shift_pressed

false

方法

BitField[KeyModifierMask]

get_modifiers_mask() const

bool

is_command_or_control_pressed() const


屬性說明

bool alt_pressed = false 🔗

  • void set_alt_pressed(value: bool)

  • bool is_alt_pressed()

Alt 修飾鍵的狀態。


bool command_or_control_autoremap = false 🔗

  • void set_command_or_control_autoremap(value: bool)

  • bool is_command_or_control_autoremap()

自動在 macOS 上使用 MetaCommand),在其他平臺上使用 Ctrl。如果為 true,則無法設定 ctrl_pressedmeta_pressed


bool ctrl_pressed = false 🔗

  • void set_ctrl_pressed(value: bool)

  • bool is_ctrl_pressed()

Ctrl 修飾鍵的狀態。


bool meta_pressed = false 🔗

  • void set_meta_pressed(value: bool)

  • bool is_meta_pressed()

Meta 修飾鍵的狀態。在 Windows 和 Linux 上代表 Windows 鍵(有時在 Linux 上稱為“meta”或“super”鍵)。在 macOS 上代表 Command 鍵。


bool shift_pressed = false 🔗

  • void set_shift_pressed(value: bool)

  • bool is_shift_pressed()

Shift 修飾鍵的狀態。


方法說明

BitField[KeyModifierMask] get_modifiers_mask() const 🔗

返回修飾鍵的鍵碼組合。


bool is_command_or_control_pressed() const 🔗

在 macOS 上,如果 MetaCommand)是按下狀態,則返回 true

在其他平臺上,如果 Ctrl 是按下狀態,則返回 true