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.

Shortcut

继承: Resource < RefCounted < Object

用于绑定输入的快捷键。

描述

Shortcuts are commonly used for interacting with a Control element from an InputEvent (also known as hotkeys).

One shortcut can contain multiple InputEvents, allowing the possibility of triggering one action with multiple different inputs.

属性

Array

events

[]

方法

String

get_as_text() const

bool

has_valid_event() const

bool

matches_event(event: InputEvent) const


属性说明

Array events = [] 🔗

  • void set_events(value: Array)

  • Array get_events()

快捷键的 InputEvent 数组。

通常使用的 InputEventInputEventKey,尽管也可以是任何 InputEvent,包括 InputEventAction


方法说明

String get_as_text() const 🔗

返回该快捷键的第一个有效 InputEventString 形式。


bool has_valid_event() const 🔗

返回 events 是否包含有效的 InputEvent


bool matches_event(event: InputEvent) const 🔗

Returns whether any InputEvent in events equals event. This uses InputEvent.is_match to compare events.