How to enable multitouch in cocos2dx | Techbirds

In order to enable multitouch just go to your AppController.mm. Then in the function didFinishLaunchingWithOptions after creating the EAGL View add the following line.

[__glView setMultipleTouchEnabled:YES];

Then the didfinishlaunchingwithoptions will look like:

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions {

// Override point for customization after application launch.

// Add the view controller’s view to the window and display. window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] pixelFormat: kEAGLColorFormatRGBA8 depthFormat: GL_DEPTH_COMPONENT16 preserveBackbuffer: NO sharegroup: nil multiSampling: NO

numberOfSamples:0 ];

[__glView setMultipleTouchEnabled:YES]; // Use RootViewController manage EAGLView viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; viewController.wantsFullScreenLayout = YES; viewController.view = __glView;

//continued…………

3,913 total views, 1 views today

Share this Onfacebook-3920610twitter-9944593linkedin-1156023google-3889593 Tags: C++, cocos2dx, Game-development, ios