Standard method for detecting swipes?


Is there any standard way that cocos2d-x developers detect swipes? In particular, I am looking for a way to differentiate between up/down/left/right swipes. It looks like one method on cocos2d is to use something like a ccTouchesBegan method to determine the touch origin, and then a ccTouchesMoved method to determine the swipe destination. Then the coordinates of origin and destination can be used to determine the direction (e.g. Is this the best way to accomplish the goal? I see that other users have come up with what look like fairly robust solutions (, I am just curious if there is a common, best-practice way to do this?

Thanks for you time!


Interesting question. I guess, we should see the the difference of X and Y coordinates regarding to initial position while listening touch move. The direction should determine the biggest shift.