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.
Checking the stable version of the documentation...
InputEventWithModifiers
继承: InputEventFromWindow < InputEvent < Resource < RefCounted < Object
派生: InputEventGesture, InputEventKey, InputEventMouse
受 Shift 和 Alt 等修饰键影响的输入事件的抽象基类。
描述
存储鼠标、键盘、触摸手势等输入事件的相关信息。包括按下了哪些修饰键等信息,修饰键包括 Shift、Alt 等。见 Node._input()。
注意:修饰键只有在与其他键同时按下时才会被认为是修饰键。因此,单独按下修饰键时,对应的 ctrl_pressed 等成员变量会返回 false
。
教程
属性
|
||
|
||
|
||
|
||
|
方法
BitField[KeyModifierMask] |
get_modifiers_mask() const |
is_command_or_control_pressed() const |
属性说明
Alt 修饰键的状态。
bool command_or_control_autoremap = false
🔗
自动在 macOS 上使用 Meta(Cmd),在其他平台上使用 Ctrl。如果为 true
,则无法设置 ctrl_pressed 和 meta_pressed。
Ctrl 修饰键的状态。
Meta 修饰键的状态。在 Windows 和 Linux 上代表 Windows 键(有时在 Linux 上称为“meta”或“super”键)。在 macOS 上代表 Command 键。
Shift 修饰键的状态。
方法说明
BitField[KeyModifierMask] get_modifiers_mask() const 🔗
返回修饰键的键码组合。
bool is_command_or_control_pressed() const 🔗
在 macOS 上,如果 Meta(Cmd)是按下状态,则返回 true
。
在其他平台上,如果 Ctrl 是按下状态,则返回 true
。