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