Touch_X Touch_Y Question

Post Reply
Logan
Posts: 2
Joined: Thu Jul 04, 2013 2:53 am

Touch_X Touch_Y Question

Post by Logan »

Not sure where to post this question so I will try here

First off I am not a programmer by trade and it is only a hobby that seems to plague me with hate. Maybe that goes for any programmer but I don't know any personally.

Question:
I have been studying the program "multitouch.txt" and I want to apply this technology to shrinking and moving pictures. There is quite a bit going on here and what I would like to know is if Touch_x and Touch_y return a -1 if not used then do the Touch commands return 0 - 10 upon touch and would I use something like

x = Touch_x(i)

if x = 0 then 'Single Touch
if x = 1 then 'Two Finger Touch

How about
if i = 0 then 'Single Touch
if i = 1 then 'Two Finger Touch

Yes I have tried these but like I said I am plagued with hate in programming. I would like to show you more code but smartBasic pissed me off and I deleted everything now only to start over again. :lol: :D :twisted:

You are passing i to Touch_*(i) I think and in multitouch you use a for loop to grab different fingers that touch the screen. I don't think I need the for loop though in order to resize a picture though :?

How does the two finger touch know when it is shrinking or expanding a picture. The numbers I get show the position of where my fingers are at on the screen and I don't know how to apply this to resizing. "Winter.txt" shows a good example of a picture but taking that program and putting it with multitouch is not working for me. Not asking you to write the program but I do need some help here :|
Pop up pictures or Easy to use coloring book with crayons :lol:

Can you elaborate more on touch x / y in order to help me understand how to move and resize a picture pasted in the graphics view ;)

Thank You :D

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Touch_X Touch_Y Question

Post by Mr. Kibernetik »

Hi!

When you use x = Touch_x(i), i - is the number of touch. Total there can be 11 simultaneous touches, with touch numbers from 0 to 10. So, command x = Touch_x(0) means that you are asking x coordinate of touch number 0. If you get x = -1 then this means that there is no touch with this number.

What about touch numbers.
First touch gets number 0, so Touch_x(0) will give you proper x-coordinate of first touch. If you keep touching and then second finger also touches the screen (so now you get two simultaneous touches), then this new touch gets number 1 and Touch_x(1) will give you x-coordinate of second touch. If you release your first touch (touch number 0) then Touch_x(0) will return -1, but Touch_x(1) will continue to give you valid x-coordinate of your second touch (touch number 1) because it is still active. Any new touch gets smallest available number, so if you touch again then this new touch will be number 0.

Logan
Posts: 2
Joined: Thu Jul 04, 2013 2:53 am

Re: Touch_X Touch_Y Question

Post by Logan »

Thanks for help and the quick response Mr. Kibernetik.

Post Reply