Page 1 of 1

TOUCH beginner

Posted: Fri Jul 01, 2016 6:50 pm
by smabasgil
About touches and GET TOUCH N AS X,Y command.
I make my first test and i am questioning...

It seems to me than once a "GET TOUCH 0" is issued, the only way to make this command to be executed again is to issue a "PAUSE n" before.

Is there some kind of reset to do before using "GET TOUCH 0" again ?

Re: TOUCH beginner

Posted: Fri Jul 01, 2016 7:05 pm
by Mr. Kibernetik
I do not understand your problem with GET TOUCH AS command. What kind of reset do you need?
Next GET TOUCH AS command works immediately.

Re: TOUCH beginner

Posted: Fri Jul 01, 2016 11:08 pm
by smabasgil
Thank you for taking care

In this code

--- --- ---

GRAPHICS
GRAPHICS CLEAR

FIELD "afcot1" TEXT "" AT 300,110 SIZE 300,25 RO
FIELD "afcot1" BACK ALPHA 0
FIELD "afcot2" TEXT "" AT 300,210 SIZE 300,25 RO
FIELD "afcot2" BACK ALPHA 0

WHILE (xt1=-1 AND yt1=-1) OR (xt1=0 AND yt1=0)
GET TOUCH 0 AS xt1,yt1
ENDWHILE

FIELD "afcot1" TEXT "xt1="&.xt1&" "&"yt1="&.yt1

WHILE (xt2=-1 AND yt2=-1) OR (xt2=0 AND yt2=0)
GET TOUCH 0 AS xt2,yt2
ENDWHILE

FIELD "afcot2" TEXT "xt2="&.xt2&" "&"yt2="&.yt2

--- --- ---

You can see that the 2 fields show the same content ( the coordinates of the first TOUCH ).

And as soon as you press one time the screen, the 2 fields are shown, it seems there no way to record a second press.

Now if you add "PAUSE .1" before :
WHILE (xt2=-1 AND yt2=-1) OR (xt2=0 AND yt2=0)

You got different coordinates in the 2nd field

That's what made me think that in the first case only one GET TOUCH can be 'seen' ou 'issued'

Re: TOUCH beginner

Posted: Sat Jul 02, 2016 2:06 am
by Mr. Kibernetik
You need to have a loop to get multiple coordinates reading:

Loop:
Get touch 0 as x,y
...
Go to loop

Re: TOUCH beginner

Posted: Sat Jul 02, 2016 11:18 am
by smabasgil
Okay

Having a labelloop: is the only correct way to discriminate touches ?

I thought that inside my "WHILE", feeding different X and Y would force the command to be executed

Re: TOUCH beginner

Posted: Sat Jul 02, 2016 11:56 am
by Mr. Kibernetik
Your WHILE loop waits for single touch and then exits. So how do you want to get next touch without main loop?