src/video/android/SDL_androidtouch.c
changeset 7191 75360622e65f
parent 7043 fb7b426ab660
child 7261 df37802bf7db
equal deleted inserted replaced
7190:11612d544fcd 7191:75360622e65f
    34 #define ACTION_DOWN 0
    34 #define ACTION_DOWN 0
    35 #define ACTION_UP 1
    35 #define ACTION_UP 1
    36 #define ACTION_MOVE 2
    36 #define ACTION_MOVE 2
    37 #define ACTION_CANCEL 3
    37 #define ACTION_CANCEL 3
    38 #define ACTION_OUTSIDE 4
    38 #define ACTION_OUTSIDE 4
    39 // The following two are deprecated but it seems they are still emitted (instead the corresponding ACTION_UP/DOWN) as of Android 3.2
    39 /* The following two are deprecated but it seems they are still emitted (instead the corresponding ACTION_UP/DOWN) as of Android 3.2 */
    40 #define ACTION_POINTER_1_DOWN 5
    40 #define ACTION_POINTER_1_DOWN 5
    41 #define ACTION_POINTER_1_UP 6
    41 #define ACTION_POINTER_1_UP 6
    42 
    42 
    43 static SDL_FingerID leftFingerDown = 0;
    43 static SDL_FingerID leftFingerDown = 0;
    44 
    44 
    50     SDL_GetWindowSize(Android_Window, &window_w, &window_h);
    50     SDL_GetWindowSize(Android_Window, &window_w, &window_h);
    51     *window_x = (int)(x * window_w);
    51     *window_x = (int)(x * window_w);
    52     *window_y = (int)(y * window_h);
    52     *window_y = (int)(y * window_h);
    53 }
    53 }
    54 
    54 
    55 void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p) 
    55 void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p)
    56 {
    56 {
    57     SDL_TouchID touchDeviceId = 0;
    57     SDL_TouchID touchDeviceId = 0;
    58     SDL_FingerID fingerId = 0;
    58     SDL_FingerID fingerId = 0;
    59     int window_x, window_y;
    59     int window_x, window_y;
    60 
    60 
   102             }
   102             }
   103             SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
   103             SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
   104             break;
   104             break;
   105         default:
   105         default:
   106             break;
   106             break;
   107     } 
   107     }
   108 }
   108 }
   109 
   109 
   110 #endif /* SDL_VIDEO_DRIVER_ANDROID */
   110 #endif /* SDL_VIDEO_DRIVER_ANDROID */
   111 
   111 
   112 /* vi: set ts=4 sw=4 expandtab: */
   112 /* vi: set ts=4 sw=4 expandtab: */