[solved] Handling fast touch events

[solved] Handling fast touch events
0.0 0



I’ve asked this question on bada specific forum here, but I think this is not platform specific. So…I’m working on a game that requires quick succession of touch events (lots of taps very quickly). What I have found is that a lots of these events are lost and not processed. If I do a quick double tap on the screen only the first tap is handled. I receive only one ccTouchBegan and one ccTouchEnded. I’ve tried raising the priority when registering the touch delegate like this CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, 255, true); but with no visible effect (I guess the priority is only used when having multiple touch delegates).
Has anyone any suggestions about what could be done to get all touch events handled?



On which platform?
May be you should check are all the touches events generated by os.


On Bada. Could you give me a hint where should I look?


CCEGLView_bada.cpp, it receives touch events.


Sorry, the full path is cocos2dx/platform/bada/CCEGLView_bada.cpp.


Thanks, I’ll have a look there. I’ll came back with results.


The problem is that the CCEGLView implements ITouchEventListener and for quick sequence of events OnTouchDoublePressed is called instead of OnTouchPressed and OnTouchReleased sequence. So it seems this is a platform issue afterall. This would be okay for a normal Ui app but for games that require fast succession of events a custom listener should be implemented that would give all touch press and release events to the cocos2d framework and let a cocos2d application decide whether it needs quick tap events or double tap events, it would give more flexibility. I would like to help with this myself, but I’m new to bada platform and didn’t found yet how to implement a custom listener or if it is even possible. The IEventListener interface is just an empty one with only the virtual destrutor, don’t know how events are propagated.
Any help or hint about how this could be accomplished, from a bada expert, would be appreciated.
I found out that bada platform calls OnTouchEventRelease after OnTouchDoublePressed but in cocos2d the double tap and the next release event is not handled. I think double tap event and next release event should be handled as a common press and release event and ccTouchBegan and ccTouchEnded should get called also for this case. I’ll make the necessary changes and see if this path would be accepted.


Does your application open accelerometer? I have found that if I enables accelerometer and multi-touch at the same time, after a quick of touching screen, application will not receive any touch message!


No, I don’t use accelerometer, and I found the solution to be pretty simple. On Bada in file CCEGLView_bada.cpp the callback CCEGLView::OnTouchDoublePressed is empty. If I call OnTouchPressed from within it is working exactly the way is supposed to, same as other platforms. I will try and push this in repository if I can. Maybe I should write a bug about this first? What say you?



In file CCEGLView_bada.cpp:

void CCEGLView::OnTouchDoublePressed(const Control& source,
@ const Point& currentPosition, const TouchEventInfo & touchInfo)@
@ OnTouchPressed(source, currentPosition, touchInfo);@


OK,I will test it. Thanks!