-
Notifications
You must be signed in to change notification settings - Fork 59
CCTapGestureRecognizer
spalx edited this page Apr 30, 2013
·
6 revisions
CCTapGestureRecognizer is a subclass of CCGestureRecognizer that looks for single or multiple taps. For the gesture to be recognized, a finger must tap the parent node a specified number of times.
//the number of taps for the gesture to be recognized.
unsigned int numberOfTapsRequired;
CCTapGestureRecognizer * tap = CCTapGestureRecognizer::create();
tap->setTarget(this, callfuncO_selector(HelloWorld::didTap));
tap->setNumberOfTapsRequired(2);
tap->setCancelsTouchesInView(true);
this->addChild(tap);
The CCTap object that you receive after a successful tap recognition, contains the following public members:
//the location of the gesture; if there are multiple taps, this location is the last tap
CCPoint location;