Skip to content

RawGesture

Federico Ciuffardi edited this page Jun 29, 2022 · 2 revisions

Description

This is a custom input event that stores the raw state of a gesture, it can be useful if you want to do something that isn't possible with the other custom input events. A RawGesture is included as a property in all the non emulated gestures. It will also be fed up to the Godot built in Input Event system when screen interactions (drag or touch) occur.

Inner classes

Event

Type Name Description
int index Finger index
float time Time of occurrence

Touch (Extends Event)

Type Name Description
Vector2 position Position of the involved finger
boolean pressed If it is true, the touch is beginning. If it is false, the touch is ending.

Drag (Extends Event)

Type Name Description
Vector2 position Position of the involved finger at the beginning of the swipe
Vector2 relative Position of the involved finger at the end of the swipe relative to its position at the beginning of the swipe

Properties

Type Name Description
Dictionary presses {Finger index : last touch (pressed)}
Dictionary releases {Finger index : last touch (released)}
Dictionary drags {Finger index : the last drag of the last touch}
int active_touches Number of fingers currently on the screen
float start_time Time when the active_touches went from 0 to 1
float elapsed_time Time elapsed from the start_time
Dictionary history {Finger index : {property_name : [events (latest at the end)] } }

Methods

Method Description
size() -> int Returns the maximum number of fingers on the screen since the gesture started
rollback_relative(time : float) -> Array Returns an array containing at index 0 the RawGesture state time seconds ago, and at index 1 the events that occurred in that last time seconds
rollback_absolute(time : float) -> Array Returns an array containing at index 0 the RawGesture state at time, and at index 1 the events between that time and now.