; Touch Playground ; Requires Extended mode. Drag several fingers; tap Clear or Exit. Graphics 800,480,0,2 SetBuffer BackBuffer() TouchMouse 0 Local running=True, taps=0, ended=0, cancelled=0, last_id=0, last_time=0 Local last_x#=0, last_y#=0, last_pressure#=-1 Local index While running UpdateMobileInput Local event=GetTouchEvent() While event last_id=TouchEventID() last_time=TouchEventTime() last_x=TouchEventX() last_y=TouchEventY() last_pressure=TouchEventPressure() If event=1 And TouchEventCaptured()=0 If last_y>=20 And last_y<70 And last_x>=620 And last_x<780 If last_x<695 taps=0 ended=0 cancelled=0 FlushTouches ElseIf last_x>=705 running=False EndIf Else taps=taps+1 EndIf EndIf If event=3 Then ended=ended+1 If event=4 Then cancelled=cancelled+1 event=GetTouchEvent() Wend If KeyHit(1) Then running=False If TouchAvailable()=0 And MouseHit(1) If MouseY()>=20 And MouseY()<70 And MouseX()>=620 And MouseX()<780 If MouseX()<695 taps=0 ended=0 cancelled=0 FlushTouches ElseIf MouseX()>=705 running=False EndIf Else taps=taps+1 last_x=MouseX() last_y=MouseY() EndIf EndIf Cls Color 80,100,140 Rect 620,20,75,50 Rect 705,20,75,50 Color 255,255,255 Text 629,35,"Clear" Text 720,35,"Exit" Text 20,20,"Touch Playground" Text 20,48,"Drag several fingers. Active: "+TouchCount()+" Begins: "+taps Text 20,78,"Ended: "+ended+" Cancelled: "+cancelled+" Overflow: "+TouchEventOverflow() Text 20,108,"Last ID: "+last_id+" Time: "+last_time+" Pressure: "+last_pressure Text 20,138,"Last point: "+last_x+", "+last_y If Not TouchAvailable() Then Text 20,168,"No direct touch source. Mouse marks a point; Esc exits." For index=1 To TouchCount() Local id=TouchID(index) Color 80+(id*47 Mod 176),100+(id*31 Mod 156),255 Oval TouchX(id)-24,TouchY(id)-24,48,48,False Text TouchX(id)+28,TouchY(id),"ID "+id Text TouchX(id)+28,TouchY(id)+20,"Delta "+TouchDX(id)+", "+TouchDY(id) Next Color 255,210,80 Oval last_x-6,last_y-6,12,12,True Flip Wend End