TouchEvent


TouchEvent action, index, x, y {,delay}


This command pauses execution and waits for the user to touch the screen. All types of touch events are returned.

The type of touch event is stored in action.

action = -1

No action

action = 0

Touch Down

action = 1

Touch Up

action = 2

Touch Move

action = 3

Touch Cancel

action = 4

Touch outside UI area

action = 5

Touch Pointer Down (when there is more than one touch point)

action = 6

Touch Pointer Up (when there is more than one touch point)


The index indicates which point is being touched. This is used for multi-touch support.

The coordinates of the touch are stored in x and y.

If the optional delay parameter is specified in milliseconds, the program will continue execution after that time. If the user did not touch the screen in that time all values will return -1.

There is a buffer which holds touch events until they are read with the touch command. If you need to clear the touch buffer execute a touch command with a delay of zero. The touch buffer will be cleared and the last touched position is returned.

Programs should always be prepared to handle Touch Cancel events and should tolerate anomalous situations such as receiving a new Touch Down without first having received a Touch Up for the prior gesture.


Touch






Become a Patron