Documentation
¶
Overview ¶
An input event for keys on a keyboard. Supports key presses, key releases and Echo events. It can also be received in Node.UnhandledKeyInput.
Note: Events received from the keyboard usually have all properties set. Event mappings should have only one of the Keycode, PhysicalKeycode or Unicode set.
When events are compared, properties are checked in the following priority - Keycode, PhysicalKeycode and Unicode. Events with the first matching value will be considered equal.
Index ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsInputEvent() InputEvent.Instance
- func (self *Extension[T]) AsInputEventFromWindow() InputEventFromWindow.Instance
- func (self *Extension[T]) AsInputEventKey() Instance
- func (self *Extension[T]) AsInputEventWithModifiers() InputEventWithModifiers.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
- func (self *Extension[T]) AsResource() Resource.Instance
- type ID
- type Instance
- func (self Instance) AsInputEvent() InputEvent.Instance
- func (self Instance) AsInputEventFromWindow() InputEventFromWindow.Instance
- func (self Instance) AsInputEventKey() Instance
- func (self Instance) AsInputEventWithModifiers() InputEventWithModifiers.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTextKeyLabel() string
- func (self Instance) AsTextKeycode() string
- func (self Instance) AsTextLocation() string
- func (self Instance) AsTextPhysicalKeycode() string
- func (self Instance) GetKeyLabelWithModifiers() Input.Key
- func (self Instance) GetKeycodeWithModifiers() Input.Key
- func (self Instance) GetPhysicalKeycodeWithModifiers() Input.Key
- func (self Instance) ID() ID
- func (self Instance) KeyLabel() Input.Key
- func (self Instance) Keycode() Input.Key
- func (self Instance) Location() Input.KeyLocation
- func (self Instance) PhysicalKeycode() Input.Key
- func (self Instance) SetEcho(value bool)
- func (self Instance) SetKeyLabel(value Input.Key)
- func (self Instance) SetKeycode(value Input.Key)
- func (self Instance) SetLocation(value Input.KeyLocation)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPhysicalKeycode(value Input.Key)
- func (self Instance) SetPressed(value bool)
- func (self Instance) SetUnicode(value int)
- func (self Instance) Unicode() int
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsInputEvent ¶
func (self *Extension[T]) AsInputEvent() InputEvent.Instance
func (*Extension[T]) AsInputEventFromWindow ¶
func (self *Extension[T]) AsInputEventFromWindow() InputEventFromWindow.Instance
func (*Extension[T]) AsInputEventKey ¶
func (*Extension[T]) AsInputEventWithModifiers ¶
func (self *Extension[T]) AsInputEventWithModifiers() InputEventWithModifiers.Instance
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.InputEventKey
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsInputEvent ¶
func (self Instance) AsInputEvent() InputEvent.Instance
func (Instance) AsInputEventFromWindow ¶
func (self Instance) AsInputEventFromWindow() InputEventFromWindow.Instance
func (Instance) AsInputEventKey ¶
func (Instance) AsInputEventWithModifiers ¶
func (self Instance) AsInputEventWithModifiers() InputEventWithModifiers.Instance
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsTextKeyLabel ¶
Returns a string representation of the event's KeyLabel and modifiers.
func (Instance) AsTextKeycode ¶
Returns a string representation of the event's Keycode and modifiers.
func (Instance) AsTextLocation ¶
Returns a string representation of the event's Location. This will be a blank string if the event is not specific to a location.
func (Instance) AsTextPhysicalKeycode ¶
Returns a string representation of the event's PhysicalKeycode and modifiers.
func (Instance) GetKeyLabelWithModifiers ¶
Returns the localized key label combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.
To get a human-readable representation of the InputEventKey with modifiers, use OS.get_keycode_string(event.get_key_label_with_modifiers()) where event is the InputEventKey.
func (Instance) GetKeycodeWithModifiers ¶
Returns the Latin keycode combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.
To get a human-readable representation of the InputEventKey with modifiers, use OS.get_keycode_string(event.get_keycode_with_modifiers()) where event is the InputEventKey.
func (Instance) GetPhysicalKeycodeWithModifiers ¶
Returns the physical keycode combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.
To get a human-readable representation of the InputEventKey with modifiers, use OS.get_keycode_string(event.get_physical_keycode_with_modifiers()) where event is the InputEventKey.
func (Instance) KeyLabel ¶
Represents the localized label printed on the key in the current keyboard layout, which corresponds to one of the [Key] constants or any valid Unicode character.
For keyboard layouts with a single label on the key, it is equivalent to Keycode.
To get a human-readable representation of the InputEventKey, use OS.get_keycode_string(event.key_label) where event is the InputEventKey.
func (Instance) Keycode ¶
Latin label printed on the key in the current keyboard layout, which corresponds to one of the [Key] constants.
To get a human-readable representation of the InputEventKey, use OS.get_keycode_string(event.keycode) where event is the InputEventKey.
func (Instance) Location ¶
func (self Instance) Location() Input.KeyLocation
Represents the location of a key which has both left and right versions, such as Shift or Alt.
func (Instance) PhysicalKeycode ¶
Represents the physical location of a key on the 101/102-key US QWERTY keyboard, which corresponds to one of the [Key] constants.
To get a human-readable representation of the InputEventKey, use OS.GetKeycodeString in combination with DisplayServer.KeyboardGetKeycodeFromPhysical:
func (Instance) SetEcho ¶
If true, the key was already pressed before this event. An echo event is a repeated key event sent when the user is holding down the key.
Note: The rate at which echo events are sent is typically around 20 events per second (after holding down the key for roughly half a second). However, the key repeat delay/speed can be changed by the user or disabled entirely in the operating system settings. To ensure your project works correctly on all configurations, do not assume the user has a specific key repeat configuration in your project's behavior.
func (Instance) SetKeyLabel ¶
SetKeyLabel sets the property returned by [GetKeyLabel].
func (Instance) SetKeycode ¶
SetKeycode sets the property returned by [GetKeycode].
func (Instance) SetLocation ¶
func (self Instance) SetLocation(value Input.KeyLocation)
SetLocation sets the property returned by [GetLocation].
func (Instance) SetPhysicalKeycode ¶
SetPhysicalKeycode sets the property returned by [GetPhysicalKeycode].
func (Instance) SetPressed ¶
If true, the key's state is pressed. If false, the key's state is released.
func (Instance) SetUnicode ¶
SetUnicode sets the property returned by [GetUnicode].
func (Instance) Unicode ¶
The key Unicode character code (when relevant), shifted by modifier keys. Unicode character codes for composite characters and complex scripts may not be available unless IME input mode is active. See Window.SetImeActive for more information.