Cocos2d-x3.2 iOS下开启多点触控
来源:互联网 发布:怎么看淘宝收货时间 编辑:程序博客网 时间:2024/05/21 13:57
iOS下默认是不开启多点触控的,我们要想要使用需要做如下的内容:
iOS文件夹下:AppController.mm
需要加一行代码:
// 只需要新增这样一行代码就可以使用多点触控啦。 [eaglView 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]]; // Init the CCEAGLView CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds] pixelFormat: kEAGLColorFormatRGBA8 depthFormat: GL_DEPTH24_STENCIL8_OES preserveBackbuffer: NO sharegroup: nil multiSampling: NO numberOfSamples: 0]; // Use RootViewController manage CCEAGLView _viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; _viewController.wantsFullScreenLayout = YES; _viewController.view = eaglView; // 只需要新增这样一行代码就可以使用多点触控啦。 [eaglView setMultipleTouchEnabled:YES]; // Set RootViewController to window if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0) { // warning: addSubView doesn't work on iOS6 [window addSubview: _viewController.view]; } else { // use this method on ios6 [window setRootViewController:_viewController]; } [window makeKeyAndVisible]; [[UIApplication sharedApplication] setStatusBarHidden:true]; // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView); cocos2d::Director::getInstance()->setOpenGLView(glview); cocos2d::Application::getInstance()->run(); return YES;}
测试:
auto listener1 = EventListenerTouchAllAtOnce::create(); listener1->setEnabled(true); listener1->onTouchesBegan = [ = ](const std::vector<Touch*>& touches, Event* event) { log("%lu",touches.size()); }; _eventDispatcher->addEventListenerWithFixedPriority(listener1, 1);
0 0
- Cocos2d-x3.2 iOS下开启多点触控
- Cocos2d-x3.2 多点触控
- Cocos2d-x3.2 多点触控
- cocos2d-x开启IOS多点触控
- cocos2d-x开启IOS多点触控
- ios开启多点触控
- Cocos2D-x3.2 -----多点触控
- cocos2d-x3.2 多点缩放单点滑动
- 【Cocos2d-x】 3.0 IOS 开启多点触摸
- Cocos2d-x3.1 多点触摸
- Cocos2d-x3.2实现虚拟摇杆多点触摸
- Cocos2d-x3.2实现虚拟摇杆多点触摸-----沈大海
- Cocos2d-x3.2实现虚拟摇杆多点触摸
- Cocos2d-x3.2实现虚拟摇杆多点触摸
- Cocos2d-x3.2实现虚拟摇杆多点触摸
- cocos2d-x3.2 单点触控
- ios cocos2d-x 接受多点触控事件
- 【Cocos2d入门教程八】浅析Cocoss2d下的多点触控
- 斯诺登泄露文件:英美联手监听德国电信
- 使用setCustomView建立标题居中的自定义ActionBar
- Linker error
- C/C++ 使用宏在编译期计算可变参数个数
- Get the 48×48 or 256×256 icon of a file on Windows
- Cocos2d-x3.2 iOS下开启多点触控
- CentOS 打包压缩文件 zip 命令详解
- android平板上EditText总是自动弹出输入法问题
- webview setting movie path:程序崩溃
- 数据结构之线性表4单链表(静态单链表)
- linux文件系统与根文件系统
- SVN框架模式和运行分析理解 适合初学者
- 网络请求生成图片
- 真正的平面上最近点对的n log(n)算法