Skip to content

burstina/SwipeEvent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwipeEvent

Swipe Event Module for Godot Engine

img2

Property Description
Swipe Time Max Time limit to detect if the gesture is a swipe or a drag
Tollerance Time tollerance between frames to adjust swipe detection
Bound to Parent If TRUE, detection will affect only parent node. That means: event.get_target() = parent_node NOTE:It has to ba any Control node to run smoothly. (if parent is not a Control node, you have to call Activate() and Deactivate() by yourself
Cumulative Drag (Pretty experimental) If detection engine doesn't detect a swipe, only a single cumulative drag event has to be trasmitted
Drag while Swipe Doesn't suppress Drag events while the engine are trying to detect swipes
Call deferred If TRUE, swipe engine submits events as deferred calls

InputEventSwipe

Event generated by SwipeEvent core module.

Type Function Name Description
Vector2 get_direction() Real swipe direction. x and y are always fully loaded
Vector2 get_speed() Computed swipe speed, in points per frame
Node get_target() if Bound to Parent is true, it returns parent node, otherwise returns null
bool left() Returns TRUE if swipe direction is heading left
bool right() Returns TRUE if swipe direction is heading right
bool up() Returns TRUE if swipe direction is heading up
bool down() Returns TRUE if swipe direction is heading down

Followind example shows how to check SwipeEvent in parent (Control) node:

img1

SceneTree build example SwipeEventDemo 1.0

Followind example shows how to use SwipeModule in scene tree. This picture shows three TextureRect nodes, each one with its own SwipeModule node, bacause we want all three TextureRect to be swiped.

img1