This is a frequently asked question. Multi-touch feature is available on both iOS & Android port since the first version of cocos2d-x. But in iOS, apple turns the switcher off by default, and offers an API to enable it manually.

iOS

Please refer to cocos2d-x/samples/Cpp/TestCpp/proj.ios/Classes/testAppDelegate.mm, line 39

[__glView setMultipleTouchEnabled:YES]

When you have a project created by xcode cocos2d-x templates, you can modify this file MyGame/proj.ios/AppController.mm as below

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

2

// Override point for customization after application launch.

4

// Add the view controller's view to the window and display.

6 window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];

7 EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]

8 pixelFormat: kEAGLColorFormatRGBA8

9 depthFormat: GL_DEPTH_COMPONENT16_OES

10 preserveBackbuffer: NO

11 sharegroup: nil

12 multiSampling: NO

13 numberOfSamples: ];

14

[__glView setMultipleTouchEnabled:YES]; // enable multi-touch here!! It's at about line 37

16

17 // ...

18

19 return YES;

20}

Apple official document about setMultipleTouchEnabled is HERE:

Android

On android, the multi-touch is open by default. You don't need to open anything before get the touch coordinates in void MyLayer::ccTouchesBegan/Moved/Ended

Other platforms

People usually debug cocos2d-x games on windows desktop system. But sadly, there's no multi-touch support on windows. You had to connect your mobile phones and test multi-touch feature on them.

Multi-touch Test Case

We added a test case for multi-touch since v2.0. After launching TestCpp, you can enter this test case from "MultiTouchTest". The video looks like this

How to Enable Multi-Touch的更多相关文章

  1. sencha touch的开源插件和例子

    写了好久的sencha touch,没想到换工作竟然一年多没有搞了.因为项目的缘故收集了好多的组件,由于懒惰,没有整理,现在想想有点后悔了,再加上如果就这样丢弃,感觉有些遗憾,今天整理了一下放在git ...

  2. WPF- 模拟触发Touch Events

    原文:WPF- 模拟触发Touch Events 基于API: [DllImport("User32.dll")] public static extern bool Initia ...

  3. java:提示Could not initialize class sun.awt.X11GraphicsEnvironment

    前几天发现tomcat提示 Could not initialize class sun.awt.X11GraphicsEnvironment  问题.以为不验证,就没太关注,今天发现,有同事提示了个 ...

  4. Tomcat远程调试catalina.sh的配置

    #!/bin/sh # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license ...

  5. linux tomca几个配置文件及点

    --------------------推荐----配置2---------------------<Connector port="8081"executor=" ...

  6. cocod2d-x 之 CCDirector、CCScene、CCSprite

    CCDirector是控制游戏流程的主要组件. typedef enum { /// sets a 2D projection (orthogonal projection)2D投机模式 kCCDir ...

  7. 转://诊断 Grid Infrastructure 启动问题 (文档 ID 1623340.1) .

    文档内容   用途   适用范围   详细信息   启动顺序:   集群状态   问题 1: OHASD 无法启动   问题 2: OHASD Agents  未启动   问题 3: OCSSD.BI ...

  8. cocos2dx 3.17.1 导演类

    进入导演类的头文件,首先看到的是一些头文件的引用:CCPlatformMacros(适配),CCRef(继承的父类),CCVector(3.0以后的新向量),CCScene(场景),CCMath(数学 ...

  9. 写一个shell 快速启动停止你的微服务吧

    在这个微服务盛行的时代,docker获得了巨大的成功,因为我们需要在一台服务器装上N个服务. 本文不是想讨论如何使用docker,而是,在一台服务器安装了多个服务后,怎样启动方便的启动服务呢? 一.在 ...

  10. Linux(Debian) 上安装tomcat并注册服务开机自启动

    1.准备工作 a.下载tomcat linux的包,地址:http://tomcat.apache.org/download-80.cgi,我们下载的版本是8.0,下载方式如图:          b ...

随机推荐

  1. ORA-12545:Connect failed beacuse target host or object does not exist

    更换计算机名,重新启动系统后 oracle 的监听器就无法正常启动, 总是提示ORA-12545:Connect failed beacuse target host or object does n ...

  2. 将现有Ubuntu系统做成LiveCD

    制作LiveCD包的工具有不少,其中比较出名的就是UCK和Reconstructor.但是这两个工具都不能把当前的操作系统制成LiveCD,备份当前操作系统,并制成LiveCD的工具也有,比如国人编写 ...

  3. oracle rac scan ip 用途 原理

    Oracle 11G R2 RAC增加了scan ip功能,在11.2之前,client链接数据库的时候要用vip,假如你的cluster有4个节点,那么客户端的tnsnames.ora中就对应有四个 ...

  4. CSS+DIV之强化background属性

    1.背景颜色属性(background-color),设定背景颜色=html中bgcolor属性.我来写一个红色背景的body,(也可以定义某个特定区域) 示例写法:body {} 2.背景图片属性( ...

  5. 将win7电脑变身WiFi热点

    转自:http://bbs.feng.com/read-htm-tid-2167498.html 开启windows 7的隐藏功能:虚拟WiFi和SoftAP(即虚拟无线AP),就可以让电脑变成无线路 ...

  6. LightOJ 1259 Goldbach`s Conjecture 水题

    不想说了 #include <cstdio> #include <iostream> #include <ctime> #include <vector> ...

  7. SQL SERVER 作业(或叫执行计划)

    如果在SQL Server 里需要定时或者每隔一段时间执行某个存储过程或3200字符以内的SQL语句时,可以用管理->SQL Server代理->作业来实现. 1.管理->SQL S ...

  8. Linux使用sudo提权时,出现xx 不在 sudoers 文件中。此事将被报告。visudo 命令简单介绍。

    在使用 sudo 临时提权时,出现:不在 sudoers 文件中.此事将被报告. 可以使用 visudo命令 来配置/etc/sudoers文件,将目标用户赋予使用sudo命令的能力. visudo命 ...

  9. c++ 弧度值与角度值的转换

    Rad_to_deg --- 弧度_到_角度 的 比率Rad_to_deg = 45.0 / atan(1.0): 弧度值到角度值的转换 用 角度 = 弧度值* Rad_to_deg 角度值到弧度值的 ...

  10. nyoj 904 hashmap

    这个题目是个水题目,现在我只管做出来,效率不考虑了. 题目链接: http://acm.nyist.net/JudgeOnline/problem.php?pid=904 我用hashmap 很爽,很 ...