[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.7.7 Detect Touchscreen Release (#J)

The Detect Touchscreen Release command detects when the touchscreen has been "released", eg your finger has been removed from the screen. If you remove your finger from the screen before the #J command, then a very short ( < 10 milliseconds) time results, allowing Cogsys to catch "premature release" events.

At "screen release", a '&' is written to the output, as well as the number of milliseconds since the #J command was encountered.

Name:
Detect Touchscreen Release
Class:
Touchscreen
Code:
#J
System:
Scans all "SDL Events" until a "MOUSEBUTTONUP" event is encountered. This event may be queued, and so may "happen" right after the #J command is encountered. Cogsys variable 7 (COGVAR_KEY) is updated with '&'. Cogsys variable 5 (COGVAR_TIME) is updated with the release time.
Output:
Writes '&' and "release time" to output.

Breakout:
NO

Test Files:
TOUCHJ_T01.IN: Tests basic operation

 
%M2
@C
%A[X320,Y100,J2,F1]
#G[Testing touchscreen "release"]#W1000

#T[F,320,240,50]#T[S,220,240,50]
%A[X320,Y240,J2,F1,C15]#G[+]

%A[Y150]#G[Touch the '+']#T[F]@C
#G[Wait...]#W1500@C

%A[Y50]#G[Touch the square]

%X[squarext.cxr]
%I[1,50,-100,0]%J[1,1,1]

#J
$AV120=V5
#I(V5<10) {@C#G[YOU RELEASED THE SCREEN TOO SOON]}{#T@C
#G[Screen released after]
$AV5=V120
%A[Y100]$SV5
%A[Y150]#G[milliseconds]
}

#W1500
@C%A[Y150]#G[Done.  Re-touch the screen to exit.]#T

Examples:

input
#J
subject
Releases the screen after 350 milliseconds
output
&350



This document was generated on November, 24 2008 using texi2html