Game Development Community

[T2D 1.3] Fully Automatic onMouseDown Bug

by Joe Virgin · in iTorque 2D · 03/16/2010 (1:24 pm) · 5 replies

I've noticed that if I drag on an object that uses mouseEvents, only on the iPhone itself, I get multiple calls to onMouseDown. Anybody else have this issue?

About the author

Joe Virgin is a programmer for Plainvue Software, Inc., a company producing iPhone games that teach math skills to the youth. Check out Fraction's Kitchen Lite, Fortune's Prime, and Chainshooter powered by iTGB and now available on the App Store.


#1
04/14/2010 (5:51 am)
I think we're having the same problem. On the iPhone if i tap, it sends one onMouseDown call, but if i drag after clicking it send multiple onMouseDown events. Big problem since im trying to use it to tap through rules. So if the user happens to click and drag it "fast fowards" throught all the pages. Unfortunately i have not found a solution to this.
#2
04/14/2010 (2:10 pm)
just worked around it using onMouseUp instead... no side effects thus far but id rather know the correct way of doing this
#3
04/14/2010 (11:02 pm)
The way I work around this is by setting a variable to true when mousedown gets called, then disallowing any mousedown related actions until mouseup is called. This has the draw back of disabling mousedown if the user touches quickly. For some reason mouseup doesn't get called if there's rapid fire touching.

Hope this helps.
#4
04/15/2010 (11:30 pm)
On the iPhone hardware, every time your touch position changes, a new touch event is generated. That is why you see multiple mouse down event.

The hardware doesn't understand the concept of "dragging". That is something that you must implement yourself as you need it for your application.
#5
04/21/2010 (1:42 pm)
I have a test fix written in C++ working on my game.

I created control object that is applied to each bitmap. If you touch part of the bitmap and remove. The control will fire touch down and up.

If your finger leaves (drag) the bitmap it will return a touch up. If you enter back (drag) in the bitmap it will return touch down.