InputEvent

package
v0.0.0-...-c858641 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Abstract base class of all types of input events. See graphics.gd/classdb/Node.Instance.Input.

Index

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 Any

type Any interface {
	gd.IsClass
	AsInputEvent() Instance
}

type Expanded

type Expanded [1]gdclass.InputEvent

func (Expanded) GetActionStrength

func (self Expanded) GetActionStrength(action string, exact_match bool) Float.X

Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type graphics.gd/classdb/InputEventJoypadMotion.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

func (Expanded) IsAction

func (self Expanded) IsAction(action string, exact_match bool) bool

Returns true if this input event matches a pre-defined action of any type.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

func (Expanded) IsActionPressed

func (self Expanded) IsActionPressed(action string, allow_echo bool, exact_match bool) bool

Returns true if the given action is being pressed (and is not an echo event for graphics.gd/classdb/InputEventKey events, unless 'allow_echo' is true). Not relevant for events of type graphics.gd/classdb/InputEventMouseMotion or graphics.gd/classdb/InputEventScreenDrag.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

Note: Due to keyboard ghosting, Instance.IsActionPressed may return false even if one of the action's keys is pressed. See Input examples in the documentation for more information.

func (Expanded) IsActionReleased

func (self Expanded) IsActionReleased(action string, exact_match bool) bool

Returns true if the given action is released (i.e. not pressed). Not relevant for events of type graphics.gd/classdb/InputEventMouseMotion or graphics.gd/classdb/InputEventScreenDrag.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

func (Expanded) IsMatch

func (self Expanded) IsMatch(event Instance, exact_match bool) bool

Returns true if the specified 'event' matches this event. Only valid for action events i.e key (graphics.gd/classdb/InputEventKey), button (graphics.gd/classdb/InputEventMouseButton or graphics.gd/classdb/InputEventJoypadButton), axis graphics.gd/classdb/InputEventJoypadMotion or action (graphics.gd/classdb/InputEventAction) events.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

Note: Only considers the event configuration (such as the keyboard key or joypad axis), not state information like Instance.IsPressed, Instance.IsReleased, Instance.IsEcho, or Instance.IsCanceled.

func (Expanded) XformedBy

func (self Expanded) XformedBy(xform Transform2D.OriginXY, local_ofs Vector2.XY) Instance

Returns a copy of the given input event which has been offset by 'local_ofs' and transformed by 'xform'. Relevant for events of type graphics.gd/classdb/InputEventMouseButton, graphics.gd/classdb/InputEventMouseMotion, graphics.gd/classdb/InputEventScreenTouch, graphics.gd/classdb/InputEventScreenDrag, graphics.gd/classdb/InputEventMagnifyGesture and graphics.gd/classdb/InputEventPanGesture.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.InputEvent

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 New

func New() Instance

func (Instance) Accumulate

func (self Instance) Accumulate(with_event Instance) bool

Returns true if the given input event and this input event can be added together (only for events of type graphics.gd/classdb/InputEventMouseMotion).

The given input event's position, global position and speed will be copied. The resulting relative is a sum of both events. Both events' modifiers have to be identical.

func (Instance) AsInputEvent

func (self Instance) AsInputEvent() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsText

func (self Instance) AsText() string

Returns a string representation of the event.

func (Instance) Device

func (self Instance) Device() int

func (Instance) GetActionStrength

func (self Instance) GetActionStrength(action string) Float.X

Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type graphics.gd/classdb/InputEventJoypadMotion.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsAction

func (self Instance) IsAction(action string) bool

Returns true if this input event matches a pre-defined action of any type.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

func (Instance) IsActionPressed

func (self Instance) IsActionPressed(action string) bool

Returns true if the given action is being pressed (and is not an echo event for graphics.gd/classdb/InputEventKey events, unless 'allow_echo' is true). Not relevant for events of type graphics.gd/classdb/InputEventMouseMotion or graphics.gd/classdb/InputEventScreenDrag.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

Note: Due to keyboard ghosting, Instance.IsActionPressed may return false even if one of the action's keys is pressed. See Input examples in the documentation for more information.

func (Instance) IsActionReleased

func (self Instance) IsActionReleased(action string) bool

Returns true if the given action is released (i.e. not pressed). Not relevant for events of type graphics.gd/classdb/InputEventMouseMotion or graphics.gd/classdb/InputEventScreenDrag.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

func (Instance) IsActionType

func (self Instance) IsActionType() bool

Returns true if this input event's type is one that can be assigned to an input action.

func (Instance) IsCanceled

func (self Instance) IsCanceled() bool

Returns true if this input event has been canceled.

func (Instance) IsEcho

func (self Instance) IsEcho() bool

Returns true if this input event is an echo event (only for events of type graphics.gd/classdb/InputEventKey). An echo event is a repeated key event sent when the user is holding down the key. Any other event type returns false.

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) IsMatch

func (self Instance) IsMatch(event Instance) bool

Returns true if the specified 'event' matches this event. Only valid for action events i.e key (graphics.gd/classdb/InputEventKey), button (graphics.gd/classdb/InputEventMouseButton or graphics.gd/classdb/InputEventJoypadButton), axis graphics.gd/classdb/InputEventJoypadMotion or action (graphics.gd/classdb/InputEventAction) events.

If 'exact_match' is false, it ignores additional input modifiers for graphics.gd/classdb/InputEventKey and graphics.gd/classdb/InputEventMouseButton events, and the direction for graphics.gd/classdb/InputEventJoypadMotion events.

Note: Only considers the event configuration (such as the keyboard key or joypad axis), not state information like Instance.IsPressed, Instance.IsReleased, Instance.IsEcho, or Instance.IsCanceled.

func (Instance) IsPressed

func (self Instance) IsPressed() bool

Returns true if this input event is pressed. Not relevant for events of type graphics.gd/classdb/InputEventMouseMotion or graphics.gd/classdb/InputEventScreenDrag.

Note: Due to keyboard ghosting, Instance.IsPressed may return false even if one of the action's keys is pressed. See Input examples in the documentation for more information.

func (Instance) IsReleased

func (self Instance) IsReleased() bool

Returns true if this input event is released. Not relevant for events of type graphics.gd/classdb/InputEventMouseMotion or graphics.gd/classdb/InputEventScreenDrag.

func (Instance) SetDevice

func (self Instance) SetDevice(value int)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

func (Instance) XformedBy

func (self Instance) XformedBy(xform Transform2D.OriginXY) Instance

Returns a copy of the given input event which has been offset by 'local_ofs' and transformed by 'xform'. Relevant for events of type graphics.gd/classdb/InputEventMouseButton, graphics.gd/classdb/InputEventMouseMotion, graphics.gd/classdb/InputEventScreenTouch, graphics.gd/classdb/InputEventScreenDrag, graphics.gd/classdb/InputEventMagnifyGesture and graphics.gd/classdb/InputEventPanGesture.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL