cocos2d 多手势

来源:未知 责任编辑:智问网络 发表时间:2013-11-04 19:43 点击:

CGPoint begen = [touch locationInView: [touch view]];

    NSSet *allTouches = [event allTouches];//获得所有触摸点 

    int count = [[allTouches allObjects] count];//当前触摸点数量,单点触摸为1.

    if (count == 1) {//单点触摸 

        UITouch *touch1 = [[allTouches allObjects] objectAtIndex:0];//获得第一个触摸点 

        switch ([touch1 tapCount]) {//判断是单击还是双击 

            case 1: 


                NSLog(@"单击\n"); 

                break; 

            case 2:  


                NSLog(@"双击\n");  

                break; 

        } 

    }else if (count == 2) {//多点触摸 

       

        CGPoint touch0_point = [[[allTouches allObjects] objectAtIndex:0] locationInView: [touch view]];

        CGPoint touch1_point = [[[allTouches allObjects] objectAtIndex:1] locationInView: [touch view]];

       

touchSpriteB_.position = touch0_point;

touchSpriteA_.position = touch1_point;

        NSLog(@"两点触摸\n%f---%f",touch0_point.x,touch1_point.x);


       

 

    发表评论
    请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
    用户名: 验证码:点击我更换图片
    最新评论 更多>>

    推荐热点

    • cocos2d-x学习笔记(19)--label 、label atlas
    • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
    • Cocos2d-x学习(一):HelloWorld
    • cocos2dx在xcode下开发,编译到android上(2)
    • cocos2d 设置屏幕默认方向
    • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
    • Cocos2d-x 2.0 之 Actions “三板斧” 之一
    • cocos2d-x学习笔记(18)--游戏打包(windows平台)
    • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1