README.gesture
changeset 4690 baf8195aeb92
parent 4689 f9ab8df6d45a
child 4693 2ede56a19f2f
equal deleted inserted replaced
4689:f9ab8df6d45a 4690:baf8195aeb92
     3 ===========================================================================
     3 ===========================================================================
     4 SDL Provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
     4 SDL Provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
     5 
     5 
     6 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. 
     6 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 
     7 
     8 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 simply re-recording on of the gestures should result in a different ID.
     8 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.
     9 
     9 
    10 Recording:
    10 Recording:
    11 ----------
    11 ----------
    12 To begin recording on a touch device call:
    12 To begin recording on a touch device call:
    13 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 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.
    15 Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
    15 Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
    16 A SDL_DOLLARRECORD event is a dgesture with the following fields:
    16 A SDL_DOLLARRECORD event is a dgesture with the following fields:
    17 
    17 
    18 event.dgesture.touchId   - the Id of the touch used to record the gesture.
    18 event.dgesture.touchId   - the Id of the touch used to record the gesture.
    19 event.dgesture.gestureId - the unique id of the recoreded gesture.
    19 event.dgesture.gestureId - the unique id of the recoreded gesture.
    20 
       
    21 
    20 
    22 
    21 
    23 Performing:
    22 Performing:
    24 -----------
    23 -----------
    25 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 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:
    51 
    50 
    52 
    51 
    53 ===========================================================================
    52 ===========================================================================
    54 Multi Gestures
    53 Multi Gestures
    55 ===========================================================================
    54 ===========================================================================
    56 SDL provides simple support to pinch/rotate/swipe gestures. 
    55 SDL provides simple support for pinch/rotate/swipe gestures. 
    57 Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
    56 Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
    58 
    57 
    59 event.mgesture.touchId - the Id of the touch on which the gesture was performed.
    58 event.mgesture.touchId - the Id of the touch on which the gesture was performed.
    60 event.mgesture.x       - the normalized x cooridinate of the gesture. (0..1)
    59 event.mgesture.x       - the normalized x cooridinate of the gesture. (0..1)
    61 event.mgesture.y       - the normalized y cooridinate of the gesture. (0..1)
    60 event.mgesture.y       - the normalized y cooridinate of the gesture. (0..1)