class InputEvent
package godot
extends Resource › Reference › Object
extended by InputEventAction, InputEventJoypadButton, InputEventJoypadMotion, InputEventMIDI, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers
Base class of all sort of input event. See godot.Node._Input.
Variables
device:Int
The event's device ID.
Note: This device ID will always be -1 for emulated mouse input from a touchscreen. This can be used to distinguish emulated mouse input from physical mouse input.
Methods
accumulate(withEvent:InputEvent):Bool
Returns true if the given input event and this input event can be added together (only for events of type godot.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.
getActionStrength(action:String, ?exactMatch:Bool):Single
Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type godot.InputEventJoypadMotion.
If exact_match is false, it ignores the input modifiers for godot.InputEventKey and godot.InputEventMouseButton events, and the direction for godot.InputEventJoypadMotion events.
isAction(action:String, ?exactMatch:Bool):Bool
Returns true if this input event matches a pre-defined action of any type.
If exact_match is false, it ignores the input modifiers for godot.InputEventKey and godot.InputEventMouseButton events, and the direction for godot.InputEventJoypadMotion events.
isActionPressed(action:String, ?allowEcho:Bool, ?exactMatch:Bool):Bool
Returns true if the given action is being pressed (and is not an echo event for godot.InputEventKey events, unless allow_echo is true). Not relevant for events of type godot.InputEventMouseMotion or godot.InputEventScreenDrag.
If exact_match is false, it ignores the input modifiers for godot.InputEventKey and godot.InputEventMouseButton events, and the direction for godot.InputEventJoypadMotion events.
Note: Due to keyboard ghosting, godot.InputEvent.isActionPressed may return false even if one of the action's keys is pressed. See [https://docs.godotengine.org/en/3.4/tutorials/inputs/input_examples.html#keyboard-events](Input examples) in the documentation for more information.
isActionReleased(action:String, ?exactMatch:Bool):Bool
Returns true if the given action is released (i.e. not pressed). Not relevant for events of type godot.InputEventMouseMotion or godot.InputEventScreenDrag.
If exact_match is false, it ignores the input modifiers for godot.InputEventKey and godot.InputEventMouseButton events, and the direction for godot.InputEventJoypadMotion events.
isActionType():Bool
Returns true if this input event's type is one that can be assigned to an input action.
isEcho():Bool
Returns true if this input event is an echo event (only for events of type godot.InputEventKey).
isPressed():Bool
Returns true if this input event is pressed. Not relevant for events of type godot.InputEventMouseMotion or godot.InputEventScreenDrag.
Note: Due to keyboard ghosting, godot.InputEvent.isActionPressed may return false even if one of the action's keys is pressed. See [https://docs.godotengine.org/en/3.4/tutorials/inputs/input_examples.html#keyboard-events](Input examples) in the documentation for more information.
shortcutMatch(event:InputEvent, ?exactMatch:Bool):Bool
Returns true if the specified event matches this event. Only valid for action events i.e key (godot.InputEventKey), button (godot.InputEventMouseButton or godot.InputEventJoypadButton), axis godot.InputEventJoypadMotion or action (godot.InputEventAction) events.
If exact_match is false, it ignores the input modifiers for godot.InputEventKey and godot.InputEventMouseButton events, and the direction for godot.InputEventJoypadMotion events.
xformedBy(xform:Transform2D, ?localOfs:Vector2):InputEvent
Returns a copy of the given input event which has been offset by local_ofs and transformed by xform. Relevant for events of type godot.InputEventMouseButton, godot.InputEventMouseMotion, godot.InputEventScreenTouch, godot.InputEventScreenDrag, godot.InputEventMagnifyGesture and godot.InputEventPanGesture.
Parameters:
localOfs | If the parameter is null, then the default value is new Vector2(0, 0) |
|---|