docs/README-touch.md
changeset 10212 af95dd343a25
parent 9066 c2af3ff967cc
child 10486 5bf595c48fd4
equal deleted inserted replaced
10211:2e4c1b2fce79 10212:af95dd343a25
    40 
    40 
    41 
    41 
    42 ===========================================================================
    42 ===========================================================================
    43 Functions
    43 Functions
    44 ===========================================================================
    44 ===========================================================================
    45 SDL provides the ability to access the underlying Finger structures.
    45 SDL provides the ability to access the underlying SDL_Finger structures.
    46 These structures should _never_ be modified.
    46 These structures should _never_ be modified.
    47 
    47 
    48 The following functions are included from SDL_touch.h
    48 The following functions are included from SDL_touch.h
    49 
    49 
    50 To get a SDL_TouchID call SDL_GetTouchDevice(index).
    50 To get a SDL_TouchID call SDL_GetTouchDevice(int index).
    51 This returns a SDL_TouchID.
    51 This returns a SDL_TouchID.
    52 IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this!
    52 IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
    53 
    53 
    54 The number of touch devices can be queried with SDL_GetNumTouchDevices().
    54 The number of touch devices can be queried with SDL_GetNumTouchDevices().
    55 
    55 
    56 A SDL_TouchID may be used to get pointers to SDL_Finger.
    56 A SDL_TouchID may be used to get pointers to SDL_Finger.
    57 
    57 
    62       float x = event.tfinger.x;
    62       float x = event.tfinger.x;
    63       float y = event.tfinger.y;
    63       float y = event.tfinger.y;
    64 
    64 
    65 
    65 
    66 
    66 
    67 To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger.
    67 To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
    68 This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed.
    68 This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
    69 A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
    69 A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
    70 As a result, be very careful to check for NULL return values.
    70 As a result, be very careful to check for NULL return values.
    71 
    71 
    72 A SDL_Finger has the following fields:
    72 A SDL_Finger has the following fields:
    73 * x,y,pressure:
    73 * x, y:
    74 	The current coordinates of the touch.
    74 	The current coordinates of the touch.
    75 * pressure:
    75 * pressure:
    76 	The pressure of the touch.
    76 	The pressure of the touch.
    77 
    77 
    78 
    78