Gesture Library
hold_and_drag.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "drag.h"
4 #include "gesturelib.h"
5 #include "recognizer.h"
6 
8 typedef struct hold_and_drag {
10 
11  // intial position
12  float x0;
13  float y0;
14 
15  // current position and velocity
16  float x;
17  float y;
18  float vx;
19  float vy;
21 
23 void init_hold_and_drag();
24 
27 void recognize_hold_and_drag(const touch_event_t* event);
28 
32 
36 int set_on_hold_and_drag(void (*listener)(const hold_and_drag_t*));
void recognize_hold_and_drag(const touch_event_t *event)
Recognize hold and drag gesture.
Definition: hold_and_drag.c:28
struct hold_and_drag hold_and_drag_t
Data structure for hold and drag data.
void init_hold_and_drag()
Initialize hold and drag data structures.
Definition: hold_and_drag.c:13
const hold_and_drag_t * get_hold_and_drag()
Access hold and drag data array of size MAX_TOUCHES.
Definition: hold_and_drag.c:37
int set_on_hold_and_drag(void(*listener)(const hold_and_drag_t *))
Subscribe listener to hold and drag gesture updates.
Definition: hold_and_drag.c:41
enum state state_t
This represents the state of individual gesture recognizers.
Data structure for hold and drag data.
Definition: hold_and_drag.h:8
state_t state
Definition: hold_and_drag.h:9
To use the gesture library, users create touch events and fill in the appropriate fields.
Definition: gesturelib.h:17