2 ===========================================================================
3 SDL provides an implementation of the $1 gesture recognition system. This allows
for recording, saving, loading, and performing single stroke gestures.
5 Gestures can be performed with any number of fingers (the centroid of the fingers must follow the
path of the gesture), but the number of fingers must be constant (
a finger cannot go down
in the middle of
a gesture). The
path of
a gesture is considered the
path from the
time when the
final finger went down, to the
first time any finger comes up.
7 Dollar gestures are assigned an Id based on
a hash
function. This is guaranteed to remain constant
for a given gesture. There is
a (small) chance that
two different gestures will be assigned the same ID. In this case, simply re-recording
one of the gestures should
result in a different ID.
11 To begin recording on
a touch
device call:
17 *
event.dgesture.touchId - the Id of the touch used to record the gesture.
18 *
event.dgesture.gestureId - the unique
id of the recorded gesture.
23 As
long as there is
a dollar gesture assigned to
a touch, every finger-up
event will also cause an
SDL_DOLLARGESTURE event with the following fields:
25 *
event.dgesture.touchId - the Id of the touch which performed the gesture.
26 *
event.dgesture.gestureId - the unique
id of the closest gesture to the performed stroke.
27 *
event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is
a better match.
28 *
event.dgesture.numFingers - the number of fingers used to draw the stroke.
30 Most
programs will want to define an appropriate error threshold and check to be sure that the error of
a gesture is not abnormally high (an indicator that no gesture was performed).
40 Both functions return the number of gestures successfully saved.
51 ===========================================================================
53 ===========================================================================
54 SDL provides simple support for pinch/rotate/swipe gestures.
57 *
event.mgesture.touchId - the Id of the touch on which the gesture was performed.
60 *
event.mgesture.dTheta - the amount that the fingers rotated during this motion.
61 *
event.mgesture.dDist - the amount that the fingers pinched during this motion.
62 *
event.mgesture.numFingers - the number of fingers used
in the gesture.
65 ===========================================================================
67 ===========================================================================
68 For
a complete example see test/testgesture.
c
70 Please direct questions/comments to:
71 jim.tla+sdl_touch@gmail.com
EGLSurface EGLnsecsANDROID time
GLint GLint GLint GLint GLint x
#define SDL_RecordGesture
static SDL_AudioDeviceID device
#define SDL_SaveDollarTemplate
#define SDL_SaveAllDollarTemplates
GLint GLint GLint GLint GLint GLint y
GLsizei const void * pointer
#define SDL_LoadDollarTemplates
GLsizei const GLchar *const * path
GLboolean GLboolean GLboolean GLboolean a
GLint GLenum GLboolean normalized