src/events/SDL_touch.c
changeset 12404 eb60e952b13f
parent 11811 5d94cb6b24d3
child 12462 b57435750c5b
equal deleted inserted replaced
12403:a4d730631698 12404:eb60e952b13f
    84         return NULL;
    84         return NULL;
    85     }
    85     }
    86     return SDL_touchDevices[index];
    86     return SDL_touchDevices[index];
    87 }
    87 }
    88 
    88 
       
    89 SDL_TouchDeviceType
       
    90 SDL_GetTouchDeviceType(SDL_TouchID id)
       
    91 {
       
    92     SDL_Touch *touch = SDL_GetTouch(id);
       
    93     if (touch) {
       
    94         return touch->type;
       
    95     }
       
    96     return SDL_TOUCH_DEVICE_INVALID;
       
    97 }
       
    98 
    89 static int
    99 static int
    90 SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
   100 SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
    91 {
   101 {
    92     int index;
   102     int index;
    93     for (index = 0; index < touch->num_fingers; ++index) {
   103     for (index = 0; index < touch->num_fingers; ++index) {
   131     }
   141     }
   132     return touch->fingers[index];
   142     return touch->fingers[index];
   133 }
   143 }
   134 
   144 
   135 int
   145 int
   136 SDL_AddTouch(SDL_TouchID touchID, const char *name)
   146 SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name)
   137 {
   147 {
   138     SDL_Touch **touchDevices;
   148     SDL_Touch **touchDevices;
   139     int index;
   149     int index;
   140 
   150 
   141     index = SDL_GetTouchIndex(touchID);
   151     index = SDL_GetTouchIndex(touchID);
   161     /* Added touch to list */
   171     /* Added touch to list */
   162     ++SDL_num_touch;
   172     ++SDL_num_touch;
   163 
   173 
   164     /* we're setting the touch properties */
   174     /* we're setting the touch properties */
   165     SDL_touchDevices[index]->id = touchID;
   175     SDL_touchDevices[index]->id = touchID;
       
   176     SDL_touchDevices[index]->type = type;
   166     SDL_touchDevices[index]->num_fingers = 0;
   177     SDL_touchDevices[index]->num_fingers = 0;
   167     SDL_touchDevices[index]->max_fingers = 0;
   178     SDL_touchDevices[index]->max_fingers = 0;
   168     SDL_touchDevices[index]->fingers = NULL;
   179     SDL_touchDevices[index]->fingers = NULL;
   169 
   180 
   170     /* Record this touch device for gestures */
   181     /* Record this touch device for gestures */