src/events/SDL_gesture.c
changeset 6951 7833f01322b3
parent 6885 700f1b25f77f
child 7009 161b7b6a5303
     1.1 --- a/src/events/SDL_gesture.c	Sat Mar 02 20:44:16 2013 -0800
     1.2 +++ b/src/events/SDL_gesture.c	Sun Mar 03 01:01:33 2013 -0800
     1.3 @@ -64,7 +64,6 @@
     1.4  
     1.5  typedef struct {
     1.6      SDL_TouchID id;
     1.7 -    SDL_FloatPoint res;
     1.8      SDL_FloatPoint centroid;
     1.9      SDL_DollarPath dollarPath;
    1.10      Uint16 numDownFingers;
    1.11 @@ -410,7 +409,7 @@
    1.12      return bestDiff;
    1.13  }
    1.14  
    1.15 -int SDL_GestureAddTouch(SDL_Touch* touch)
    1.16 +int SDL_GestureAddTouch(SDL_TouchID touchId)
    1.17  {
    1.18      SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
    1.19                                                                       (SDL_numGestureTouches + 1) *
    1.20 @@ -423,12 +422,8 @@
    1.21  
    1.22      SDL_gestureTouch = gestureTouch;
    1.23  
    1.24 -    SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres;
    1.25 -    SDL_gestureTouch[SDL_numGestureTouches].res.y = touch->yres;
    1.26      SDL_gestureTouch[SDL_numGestureTouches].numDownFingers = 0;
    1.27 -
    1.28 -    SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres;
    1.29 -    SDL_gestureTouch[SDL_numGestureTouches].id = touch->id;
    1.30 +    SDL_gestureTouch[SDL_numGestureTouches].id = touchId;
    1.31  
    1.32      SDL_gestureTouch[SDL_numGestureTouches].numDollarTemplates = 0;
    1.33  
    1.34 @@ -468,11 +463,8 @@
    1.35      SDL_Event event;
    1.36      event.dgesture.type = SDL_DOLLARGESTURE;
    1.37      event.dgesture.touchId = touch->id;
    1.38 -    /*
    1.39 -    //TODO: Add this to give location of gesture?
    1.40      event.mgesture.x = touch->centroid.x;
    1.41      event.mgesture.y = touch->centroid.y;
    1.42 -    */
    1.43      event.dgesture.gestureId = gestureId;
    1.44      event.dgesture.error = error;
    1.45      //A finger came up to trigger this event.
    1.46 @@ -513,14 +505,8 @@
    1.47          //Shouldn't be possible
    1.48          if (inTouch == NULL) return;
    1.49  
    1.50 -        //printf("@ (%i,%i) with res: (%i,%i)\n",(int)event->tfinger.x,
    1.51 -        //           (int)event->tfinger.y,
    1.52 -        //   (int)inTouch->res.x,(int)inTouch->res.y);
    1.53 -
    1.54 -
    1.55 -        x = ((float)event->tfinger.x)/(float)inTouch->res.x;
    1.56 -        y = ((float)event->tfinger.y)/(float)inTouch->res.y;
    1.57 -
    1.58 +        x = event->tfinger.x;
    1.59 +        y = event->tfinger.y;
    1.60  
    1.61          //Finger Up
    1.62          if (event->type == SDL_FINGERUP) {
    1.63 @@ -569,9 +555,8 @@
    1.64              }
    1.65          }
    1.66          else if (event->type == SDL_FINGERMOTION) {
    1.67 -            float dx = ((float)event->tfinger.dx)/(float)inTouch->res.x;
    1.68 -            float dy = ((float)event->tfinger.dy)/(float)inTouch->res.y;
    1.69 -            //printf("dx,dy: (%f,%f)\n",dx,dy);
    1.70 +            float dx = event->tfinger.dx;
    1.71 +            float dy = event->tfinger.dy;
    1.72  #ifdef ENABLE_DOLLAR
    1.73              SDL_DollarPath* path = &inTouch->dollarPath;
    1.74              if (path->numPoints < MAXPATHSIZE) {