cocos2d 多手势
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);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>