Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to enable multitouch mode in cocos2d-x using c++.There are answers related to how to enable it on cocos2d but I want to enable it in cocos2d-x.Any help will be appreciated
Posted

I myself got the answer.In order to enable multitouch just go to your AppController.mm then in the function didFinishLaunchingWithOptions after creating the EAGL View just add the following code.
C++
[__glView setMultipleTouchEnabled:YES];

So now the function should look like this
C++
(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.....
 
Share this answer
 
When you downloaded cocos2d-x you should have downloaded all the tests - and these include (I think) multitouch tests - so you can run the test and look at the source there.
 
Share this answer
 
Comments
Rajan Maheshwari 5-Feb-14 23:06pm    
no this is not the answer.I myself got the answer.I will post the solution now
_Maxxx_ 5-Feb-14 23:22pm    
Well, your solution could have been copied and pasted from the source code I told you to look at!
Rajan Maheshwari 5-Feb-14 23:27pm    
anyhow..thanks for your time.can you help me in one more question.Question is
http://www.codeproject.com/Questions/720772/How-to-make-a-sprite-jump-like-a-frog-in-cocos2d-x

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900