MultiTouch - is there a better way to do this?
by Benjamin Cole · in iTorque 2D · 10/12/2010 (10:47 am) · 2 replies
Hi all,
I'm working on adding a control pad with buttons to my game, and I'm running into some multi-touch issues.
So, here's what I'm doing now: I'm listening for an iPhoneTouchDown event at the location of my UI object and capturing the touch number sent. I have the state of the button set to "DOWN" until I get sent the same touch number back in my oniPhoneTouchUp listener, then I set it to UP. Depending on the type of object it will execute code based on it's up or down state.
This is a pain in the butt for several reasons. First, I have to listen for touch events in script (when I would rather be doing it in C++). Second, I looked though the source, and there doesn't seem to be any way to capture the object sending the event. Of course, because of how I'm doing everything, I can get glitchy behavior (touching with 2 fingers at the same time breaks things).
Ideally, I'd like to have a control pad and a button... but it's more difficult to do this than I anticipated. Anyone solved this problem in an elegant way?
I'm working on adding a control pad with buttons to my game, and I'm running into some multi-touch issues.
So, here's what I'm doing now: I'm listening for an iPhoneTouchDown event at the location of my UI object and capturing the touch number sent. I have the state of the button set to "DOWN" until I get sent the same touch number back in my oniPhoneTouchUp listener, then I set it to UP. Depending on the type of object it will execute code based on it's up or down state.
This is a pain in the butt for several reasons. First, I have to listen for touch events in script (when I would rather be doing it in C++). Second, I looked though the source, and there doesn't seem to be any way to capture the object sending the event. Of course, because of how I'm doing everything, I can get glitchy behavior (touching with 2 fingers at the same time breaks things).
Ideally, I'd like to have a control pad and a button... but it's more difficult to do this than I anticipated. Anyone solved this problem in an elegant way?
About the author
#2
For now, though, since I'm ONLY doing a single button and control pad -- I'll just hack it in and forget about it :p.
10/29/2010 (5:23 pm)
Yeah... that's kind of what I've been doing. I'm rather unhappy with doing it this way. I was hoping to be able to get some kind of UI response back from a touch. I just spent a week troubleshooting some problems with the mouseLeave UI response being broken - so I may revisit this once I get some free time.For now, though, since I'm ONLY doing a single button and control pad -- I'll just hack it in and forget about it :p.
Conor O'Kane
cokane.com