Documentation
¶
Overview ¶
Abstract base class of all types of input events. See graphics.gd/classdb/Node.Instance.Input.
Index ¶
- type Advanced
- type Any
- type Expanded
- func (self Expanded) GetActionStrength(action string, exact_match bool) Float.X
- func (self Expanded) IsAction(action string, exact_match bool) bool
- func (self Expanded) IsActionPressed(action string, allow_echo bool, exact_match bool) bool
- func (self Expanded) IsActionReleased(action string, exact_match bool) bool
- func (self Expanded) IsMatch(event Instance, exact_match bool) bool
- func (self Expanded) XformedBy(xform Transform2D.OriginXY, local_ofs Vector2.XY) Instance
- type Extension
- type ID
- type Instance
- func (self Instance) Accumulate(with_event Instance) bool
- func (self Instance) AsInputEvent() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsText() string
- func (self Instance) Device() int
- func (self Instance) GetActionStrength(action string) Float.X
- func (self Instance) ID() ID
- func (self Instance) IsAction(action string) bool
- func (self Instance) IsActionPressed(action string) bool
- func (self Instance) IsActionReleased(action string) bool
- func (self Instance) IsActionType() bool
- func (self Instance) IsCanceled() bool
- func (self Instance) IsEcho() bool
- func (self Instance) IsMatch(event Instance) bool
- func (self Instance) IsPressed() bool
- func (self Instance) IsReleased() bool
- func (self Instance) SetDevice(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) XformedBy(xform Transform2D.OriginXY) Instance
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 Expanded ¶
type Expanded [1]gdclass.InputEvent
func (Expanded) GetActionStrength ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 (*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.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 (Instance) Accumulate ¶
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 (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) GetActionStrength ¶
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) IsAction ¶
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 ¶
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 ¶
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 ¶
Returns true if this input event's type is one that can be assigned to an input action.
func (Instance) IsCanceled ¶
Returns true if this input event has been canceled.
func (Instance) IsEcho ¶
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 ¶
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 ¶
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 ¶
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) 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.