src/events/SDL_gesture.c
changeset 8705 fee2f7e242a1
parent 8296 cb13016bf07b
child 8726 9a5a5808aa14
equal deleted inserted replaced
8704:2732c28ca4db 8705:fee2f7e242a1
   135 {
   135 {
   136     int i,j,rtrn = 0;
   136     int i,j,rtrn = 0;
   137     for (i = 0; i < SDL_numGestureTouches; i++) {
   137     for (i = 0; i < SDL_numGestureTouches; i++) {
   138         SDL_GestureTouch* touch = &SDL_gestureTouch[i];
   138         SDL_GestureTouch* touch = &SDL_gestureTouch[i];
   139         for (j = 0; j < touch->numDollarTemplates; j++) {
   139         for (j = 0; j < touch->numDollarTemplates; j++) {
   140             rtrn += SaveTemplate(&touch->dollarTemplate[i], dst);
   140             rtrn += SaveTemplate(&touch->dollarTemplate[j], dst);
   141         }
   141         }
   142     }
   142     }
   143     return rtrn;
   143     return rtrn;
   144 }
   144 }
   145 
   145 
   148     int i,j;
   148     int i,j;
   149     for (i = 0; i < SDL_numGestureTouches; i++) {
   149     for (i = 0; i < SDL_numGestureTouches; i++) {
   150         SDL_GestureTouch* touch = &SDL_gestureTouch[i];
   150         SDL_GestureTouch* touch = &SDL_gestureTouch[i];
   151         for (j = 0; j < touch->numDollarTemplates; j++) {
   151         for (j = 0; j < touch->numDollarTemplates; j++) {
   152             if (touch->dollarTemplate[i].hash == gestureId) {
   152             if (touch->dollarTemplate[i].hash == gestureId) {
   153                 return SaveTemplate(&touch->dollarTemplate[i], dst);
   153                 return SaveTemplate(&touch->dollarTemplate[j], dst);
   154             }
   154             }
   155         }
   155         }
   156     }
   156     }
   157     return SDL_SetError("Unknown gestureId");
   157     return SDL_SetError("Unknown gestureId");
   158 }
   158 }
   452                           SDL_GestureID gestureId,float error)
   452                           SDL_GestureID gestureId,float error)
   453 {
   453 {
   454     SDL_Event event;
   454     SDL_Event event;
   455     event.dgesture.type = SDL_DOLLARGESTURE;
   455     event.dgesture.type = SDL_DOLLARGESTURE;
   456     event.dgesture.touchId = touch->id;
   456     event.dgesture.touchId = touch->id;
   457     event.mgesture.x = touch->centroid.x;
   457     event.dgesture.x = touch->centroid.x;
   458     event.mgesture.y = touch->centroid.y;
   458     event.dgesture.y = touch->centroid.y;
   459     event.dgesture.gestureId = gestureId;
   459     event.dgesture.gestureId = gestureId;
   460     event.dgesture.error = error;
   460     event.dgesture.error = error;
   461     /* A finger came up to trigger this event. */
   461     /* A finger came up to trigger this event. */
   462     event.dgesture.numFingers = touch->numDownFingers + 1;
   462     event.dgesture.numFingers = touch->numDownFingers + 1;
   463     return SDL_PushEvent(&event) > 0;
   463     return SDL_PushEvent(&event) > 0;