29 static void update_stroke(
const touch_event_t* event,
char up);
34 switch (event->
type) {
39 update_stroke(event, 0);
42 update_stroke(event, 1);
71 static void update_stroke(
const touch_event_t* event,
char up) {
74 if (event->
t > last->
t) {
75 float vx = (
event->x - last->
x) / (event->
t - last->
t);
76 float vy = (
event->y - last->
y) / (event->
t - last->
t);
88 static void update_velocity(
stroke_t*
stroke,
float vx,
float vy) {
touch_event_t latest_touch_events[MAX_TOUCHES]
set containing most recent touch within finger group
@ RECOGNIZER_STATE_IN_PROGRESS
@ RECOGNIZER_STATE_COMPLETED
void init_stroke()
Initialize stroke data structures.
stroke_t stroke_d[MAX_TOUCHES]
const stroke_t * get_stroke()
Access array of stroke_t of size MAX_TOUCHES.
void recognize_stroke(const touch_event_t *event)
Recognize stroke gesture.
#define STROKE_CACHE_SIZE
Data structure for stroke gesture data.
float cache_vy[STROKE_CACHE_SIZE]
float cache_vx[STROKE_CACHE_SIZE]
To use the gesture library, users create touch events and fill in the appropriate fields.