README-touch.txt
changeset 7222 2435b221d77d
parent 7127 5011ddf43295
child 7241 28602f5ca96d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/README-touch.txt	Sun May 26 11:06:17 2013 -0700
     1.3 @@ -0,0 +1,84 @@
     1.4 +===========================================================================
     1.5 +System Specific Notes
     1.6 +===========================================================================
     1.7 +Linux:
     1.8 +The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
     1.9 +
    1.10 +ac: 
    1.11 +The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
    1.12 +
    1.13 +iPhone: 
    1.14 +Works out of box.
    1.15 +
    1.16 +Windows:
    1.17 +Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
    1.18 +
    1.19 +===========================================================================
    1.20 +Events
    1.21 +===========================================================================
    1.22 +SDL_FINGERDOWN:
    1.23 +Sent when a finger (or stylus) is placed on a touch device.
    1.24 +Fields:
    1.25 +event.tfinger.touchId  - the Id of the touch device.
    1.26 +event.tfinger.fingerId - the Id of the finger which just went down.
    1.27 +event.tfinger.x        - the x coordinate of the touch (0..1)
    1.28 +event.tfinger.y        - the y coordinate of the touch (0..1)
    1.29 +event.tfinger.pressure - the pressure of the touch (0..1)
    1.30 +
    1.31 +SDL_FINGERMOTION:
    1.32 +Sent when a finger (or stylus) is moved on the touch device.
    1.33 +Fields:
    1.34 +Same as SDL_FINGERDOWN but with additional:
    1.35 +event.tfinger.dx       - change in x coordinate during this motion event.
    1.36 +event.tfinger.dy       - change in y coordinate during this motion event.
    1.37 +
    1.38 +SDL_FINGERUP:
    1.39 +Sent when a finger (or stylus) is lifted from the touch device.
    1.40 +Fields:
    1.41 +Same as SDL_FINGERDOWN.
    1.42 +
    1.43 +
    1.44 +===========================================================================
    1.45 +Functions
    1.46 +===========================================================================
    1.47 +SDL provides the ability to access the underlying Finger structures.
    1.48 +These structures should _never_ be modified.
    1.49 +
    1.50 +The following functions are included from SDL_touch.h
    1.51 +
    1.52 +To get a SDL_TouchID call SDL_GetTouchDevice(index).
    1.53 +This returns a SDL_TouchID.
    1.54 +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!
    1.55 +
    1.56 +The number of touch devices can be queried with SDL_GetNumTouchDevices().
    1.57 +
    1.58 +A SDL_TouchID may be used to get pointers to SDL_Finger.
    1.59 +
    1.60 +SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
    1.61 +
    1.62 +The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
    1.63 +
    1.64 +      float x = event.tfinger.x;
    1.65 +      float y = event.tfinger.y;
    1.66 +
    1.67 +
    1.68 +
    1.69 +To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger.
    1.70 +This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed.
    1.71 +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.
    1.72 +As a result, be very careful to check for NULL return values.
    1.73 +
    1.74 +A SDL_Finger has the following fields:
    1.75 +>x,y,pressure:
    1.76 +	The current coordinates of the touch.
    1.77 +>pressure:
    1.78 +	The pressure of the touch.
    1.79 +
    1.80 +===========================================================================
    1.81 +Notes
    1.82 +===========================================================================
    1.83 +For a complete example see test/testgesture.c
    1.84 +
    1.85 +Please direct questions/comments to:
    1.86 +   jim.tla+sdl_touch@gmail.com
    1.87 +   (original author, API was changed since)