docs/README-gesture.md
changeset 9066 c2af3ff967cc
parent 9025 d09d4b578e77
child 9464 ae7a6c8cc189
equal deleted inserted replaced
9065:c8a8b11fd0ad 9066:c2af3ff967cc
    12 SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
    12 SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
    13 
    13 
    14 Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
    14 Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
    15 A SDL_DOLLARRECORD event is a dgesture with the following fields:
    15 A SDL_DOLLARRECORD event is a dgesture with the following fields:
    16 
    16 
    17 event.dgesture.touchId   - the Id of the touch used to record the gesture.
    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.
    18 * event.dgesture.gestureId - the unique id of the recorded gesture.
    19 
    19 
    20 
    20 
    21 Performing:
    21 Performing:
    22 -----------
    22 -----------
    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:
    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:
    24 
    24 
    25 event.dgesture.touchId    - the Id of the touch which performed the gesture.
    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.
    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.
    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.
    28 * event.dgesture.numFingers - the number of fingers used to draw the stroke.
    29 
    29 
    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).
    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).
    31 
    31 
    32 
    32 
    33 
    33 
    52 Multi Gestures
    52 Multi Gestures
    53 ===========================================================================
    53 ===========================================================================
    54 SDL provides simple support for pinch/rotate/swipe gestures. 
    54 SDL provides simple support for pinch/rotate/swipe gestures. 
    55 Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
    55 Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
    56 
    56 
    57 event.mgesture.touchId - the Id of the touch on which the gesture was performed.
    57 * event.mgesture.touchId - the Id of the touch on which the gesture was performed.
    58 event.mgesture.x       - the normalized x coordinate of the gesture. (0..1)
    58 * event.mgesture.x       - the normalized x coordinate of the gesture. (0..1)
    59 event.mgesture.y       - the normalized y coordinate of the gesture. (0..1)
    59 * event.mgesture.y       - the normalized y coordinate of the gesture. (0..1)
    60 event.mgesture.dTheta  - the amount that the fingers rotated during this motion.
    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.
    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.
    62 * event.mgesture.numFingers - the number of fingers used in the gesture.
    63 
    63 
    64 
    64 
    65 ===========================================================================
    65 ===========================================================================
    66 Notes
    66 Notes
    67 ===========================================================================
    67 ===========================================================================