cocos2d-x: Enable Multi-touch support in iOS
To enable multi-touch support in iOS:
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds] pixelFormat: (NSString*)cocos2d::GLViewImpl::_pixelFormat depthFormat: cocos2d::GLViewImpl::_depthFormat preserveBackbuffer: NO sharegroup: nil multiSampling: NO numberOfSamples: 0 ]; // Enable or disable multiple touches [eaglView setMultipleTouchEnabled:YES];
And register EventListenerTouchAllAtOnce as following:
auto listener= EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan= CC_CALLBACK_2(GameLayer::onTouchesBegan, this); listener->onTouchesMoved= CC_CALLBACK_2(GameLayer::onTouchesMoved, this); listener->onTouchesEnded= CC_CALLBACK_2(GameLayer::onTouchesEnded, this); listener->onTouchesCancelled= CC_CALLBACK_2(GameLayer::onTouchesCancelled, this); Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);