Multi Touch
I'm trying properly handle multi touches. I'm using touchesBegan, touchesMoved etc and I've run into the following scenario:
I get an event for touch A
Then an event for touch B
Then, I can track if a touch has been moved, but I dont know whether it was A or B that was moved. Any ideas on how to solve this?
Thanks
I get an event for touch A
Then an event for touch B
Then, I can track if a touch has been moved, but I dont know whether it was A or B that was moved. Any ideas on how to solve this?
Thanks
wonza Wrote:I'm trying properly handle multi touches. I'm using touchesBegan, touchesMoved etc and I've run into the following scenario:
I get an event for touch A
Then an event for touch B
Then, I can track if a touch has been moved, but I dont know whether it was A or B that was moved. Any ideas on how to solve this?
Thanks
Firstly you must activate it.
Sorry, I should have mentioned I have activated it. I'm just wondering how u track between touches, it says something I'm the docs about copying the status of each touch object but I'm not sure what that means and how I would use it to know which touch is which.
Thanks!
Thanks!
wonza Wrote:Sorry, I should have mentioned I have activated it. I'm just wondering how u track between touches, it says something I'm the docs about copying the status of each touch object but I'm not sure what that means and how I would use it to know which touch is which.Although it's not clear at all in the documentation, each touch object is persistent from "began" to "end/cancelled". So you can save a pointer to each touch object or use their hashes to identify them in the next callback.
Frank C. Wrote:Although it's not clear at all in the documentation, each touch object is persistent from "began" to "end/cancelled". So you can save a pointer to each touch object or use their hashes to identify them in the next callback.Thanks for pointing this out. I just re-read the UITouch class documentation, and you're right -- it's not plainly obvious. In fact, it's kind of buried in a single sentence in the overview.
Just be sure that if you do "save a pointer" to a UITouch instance, you're not retaining it. In that same overview section, the docs say you should never do that.
dont suppose you have a little sample code for me? I need spoon feeding sometimes
mainly because Im still not that used to C yet.
mainly because Im still not that used to C yet.
wonza Wrote:dont suppose you have a little sample code for me? I need spoon feeding sometimesmainly because Im still not that used to C yet.
Well you'll need to brush up on your Obj-C if you want to get anywhere with the SDK but basically when you get your UITouch objects in touchesBegan you'd stick the hashes into some variable/class/structure you can access later - e.g.:
Code:
myhash = [touch hash];Code:
if (myhash == [touch hash]) { // Same touch, so do stuff }
Thanks, thats exactly what I was after!
yeah, I really need to learn more about Obj-C, Im just picking it up as I go along really
yeah, I really need to learn more about Obj-C, Im just picking it up as I go along really
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Enable Multi-Touch? | MrPenguin9 | 4 | 3,399 |
Mar 14, 2010 12:55 PM Last Post: MrPenguin9 |
|
| Multi-touch failing | Sumaleth | 1 | 2,227 |
Feb 24, 2010 08:49 PM Last Post: Sumaleth |
|
| Multi touch individual fingers | jjslay | 3 | 2,856 |
Jun 18, 2009 10:01 AM Last Post: jjslay |
|
| Multi touch response time | captainfreedom | 12 | 6,399 |
May 9, 2009 12:35 PM Last Post: Frank C. |
|
| Input performance with multi touch | godexsoft | 6 | 3,195 |
Jan 17, 2009 12:04 AM Last Post: longjumper |
|

