src/video/uikit/SDL_uikitview.m
changeset 6951 7833f01322b3
parent 6950 1ddb72193079
child 7050 aa1f44908402
     1.1 --- a/src/video/uikit/SDL_uikitview.m	Sat Mar 02 20:44:16 2013 -0800
     1.2 +++ b/src/video/uikit/SDL_uikitview.m	Sun Mar 03 01:01:33 2013 -0800
     1.3 @@ -52,23 +52,8 @@
     1.4  
     1.5      self.multipleTouchEnabled = YES;
     1.6  
     1.7 -    SDL_Touch touch;
     1.8 -    touch.id = 0; //TODO: Should be -1?
     1.9 -
    1.10 -    //touch.driverdata = SDL_malloc(sizeof(EventTouchData));
    1.11 -    //EventTouchData* data = (EventTouchData*)(touch.driverdata);
    1.12 -
    1.13 -    touch.x_min = 0;
    1.14 -    touch.x_max = 1;
    1.15 -    touch.native_xres = touch.x_max - touch.x_min;
    1.16 -    touch.y_min = 0;
    1.17 -    touch.y_max = 1;
    1.18 -    touch.native_yres = touch.y_max - touch.y_min;
    1.19 -    touch.pressure_min = 0;
    1.20 -    touch.pressure_max = 1;
    1.21 -    touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    1.22 -
    1.23 -    touchId = SDL_AddTouch(&touch, "IPHONE SCREEN");
    1.24 +    touchId = 1;
    1.25 +    SDL_AddTouch(touchId, "");
    1.26  
    1.27      return self;
    1.28  
    1.29 @@ -117,17 +102,15 @@
    1.30          // FIXME: TODO: Using touch as the fingerId is potentially dangerous
    1.31          // It is also much more efficient than storing the UITouch pointer
    1.32          // and comparing it to the incoming event.
    1.33 -        SDL_SendFingerDown(touchId, (SDL_FingerID)touch,
    1.34 -                           SDL_TRUE, locationInView.x, locationInView.y,
    1.35 -                           1);
    1.36 +        SDL_SendTouch(touchId, (SDL_FingerID)touch,
    1.37 +                      SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
    1.38  #else
    1.39          int i;
    1.40          for(i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
    1.41              if (finger[i] == NULL) {
    1.42                  finger[i] = touch;
    1.43 -                SDL_SendFingerDown(touchId, i,
    1.44 -                                   SDL_TRUE, locationInView.x, locationInView.y,
    1.45 -                                   1);
    1.46 +                SDL_SendTouch(touchId, i,
    1.47 +                              SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
    1.48                  break;
    1.49              }
    1.50          }
    1.51 @@ -150,16 +133,14 @@
    1.52  
    1.53          CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
    1.54  #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    1.55 -        SDL_SendFingerDown(touchId, (long)touch,
    1.56 -                           SDL_FALSE, locationInView.x, locationInView.y,
    1.57 -                           1);
    1.58 +        SDL_SendTouch(touchId, (long)touch,
    1.59 +                      SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
    1.60  #else
    1.61          int i;
    1.62          for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
    1.63              if (finger[i] == touch) {
    1.64 -                SDL_SendFingerDown(touchId, i,
    1.65 -                                   SDL_FALSE, locationInView.x, locationInView.y,
    1.66 -                                   1);
    1.67 +                SDL_SendTouch(touchId, i,
    1.68 +                              SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
    1.69                  finger[i] = NULL;
    1.70                  break;
    1.71              }
    1.72 @@ -195,15 +176,13 @@
    1.73          CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
    1.74  #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    1.75          SDL_SendTouchMotion(touchId, (long)touch,
    1.76 -                            SDL_FALSE, locationInView.x, locationInView.y,
    1.77 -                            1);
    1.78 +                            locationInView.x, locationInView.y, 1.0f);
    1.79  #else
    1.80          int i;
    1.81          for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
    1.82              if (finger[i] == touch) {
    1.83                  SDL_SendTouchMotion(touchId, i,
    1.84 -                                    SDL_FALSE, locationInView.x, locationInView.y,
    1.85 -                                    1);
    1.86 +                                    locationInView.x, locationInView.y, 1.0f);
    1.87                  break;
    1.88              }
    1.89          }