2014-02-05 32 views

回答

1

我自己得到了答案。为了启用多点触控只需去你的AppController.mm 然后在函数didFinishLaunchingWithOptions创建EAGL视图后只需添加下面的代码。

[__glView setMultipleTouchEnabled:YES]; 

所以,现在的功能应该是这样的

(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..... 
0

对于其他平台,这应该是在默认情况下,但针对iOS您需要启用它。从Cocos2d-x 3.16开始,修改cocos new命令行工具生成的RootViewController.mm的一行,以启用多点触控。

--- a/proj.ios_mac/ios/RootViewController.mm 
+++ b/proj.ios_mac/ios/RootViewController.mm 
@@ -52,7 +52,7 @@ 
             numberOfSamples: 0 ]; 

    // Enable or disable multiple touches 
- [eaglView setMultipleTouchEnabled:NO]; 
+ [eaglView setMultipleTouchEnabled:YES]; 
相关问题