InputEvent
Abstract base class for input events.
InputEvent.swift:17class InputEvent
Abstract base class of all types of input events. See _input(event:)
.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
static let deviceIdEmulation: Int
Device ID used for emulated mouse input from a touchscreen, or for emulated touch input from a mouse. This can be used to distinguish emulated mouse input from physical mouse input, or emulated touch input from physical touch input.
class var godotClassName: StringName
Instance members
var device: Int32
The event’s device ID.
func accumulate(withEvent: InputEvent?
) -> Bool Returns
true
if the given input event and this input event can be added together (only for events of typeInputEventMouseMotion
).func asText(
) -> String Returns a
String
representation of the event.func getActionStrength(action: StringName, exactMatch: Bool
) -> Double Returns a value between 0.0 and 1.0 depending on the given actions’ state. Useful for getting the value of events of type
InputEventJoypadMotion
.func isAction(StringName, exactMatch: Bool
) -> Bool Returns
true
if this input event matches a pre-defined action of any type.func isActionPressed(action: StringName, allowEcho: Bool, exactMatch: Bool
) -> Bool Returns
true
if the given action is being pressed (and is not an echo event forInputEventKey
events, unlessallowEcho
istrue
). Not relevant for events of typeInputEventMouseMotion
orInputEventScreenDrag
.func isActionReleased(action: StringName, exactMatch: Bool
) -> Bool Returns
true
if the given action is released (i.e. not pressed). Not relevant for events of typeInputEventMouseMotion
orInputEventScreenDrag
.func isActionType(
) -> Bool Returns
true
if this input event’s type is one that can be assigned to an input action.func isCanceled(
) -> Bool Returns
true
if this input event has been canceled.func isEcho(
) -> Bool Returns
true
if this input event is an echo event (only for events of typeInputEventKey
). An echo event is a repeated key event sent when the user is holding down the key. Any other event type returnsfalse
.func isMatch(event: InputEvent?, exactMatch: Bool
) -> Bool Returns
true
if the specifiedevent
matches this event. Only valid for action events i.e key (InputEventKey
), button (InputEventMouseButton
orInputEventJoypadButton
), axisInputEventJoypadMotion
or action (InputEventAction
) events.func isPressed(
) -> Bool Returns
true
if this input event is pressed. Not relevant for events of typeInputEventMouseMotion
orInputEventScreenDrag
.func isReleased(
) -> Bool Returns
true
if this input event is released. Not relevant for events of typeInputEventMouseMotion
orInputEventScreenDrag
.func xformedBy(xform: Transform2D, localOfs: Vector2
) -> InputEvent? Returns a copy of the given input event which has been offset by
localOfs
and transformed byxform
. Relevant for events of typeInputEventMouseButton
,InputEventMouseMotion
,InputEventScreenTouch
,InputEventScreenDrag
,InputEventMagnifyGesture
andInputEventPanGesture
.
Subclasses
class InputEventAction
An input event type for actions.
class InputEventFromWindow
Abstract base class for
Viewport
-based input events.class InputEventJoypadButton
Represents a gamepad button being pressed or released.
class InputEventJoypadMotion
Represents axis motions (such as joystick or analog triggers) from a gamepad.
class InputEventMIDI
Represents a MIDI message from a MIDI device, such as a musical keyboard.
class InputEventShortcut
Represents a triggered keyboard
Shortcut
.