我正在使用box2d在xcode中编写应用程序。现在我正在使用下面的代码。问题是它只能处理一次触摸事件。我怎样才能让我的代码处理所有的触摸事件,在这种情况下,检查每个触摸的位置。我也想存储触摸,以便当它们结束时,我可以使用正确的代码来结束任何单个触摸开始。如何处理多点触控
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
CGSize screenSize = [CCDirector sharedDirector].winSize;
if (locationWorld.x >= screenSize.width*2/5/PTM_RATIO && locationWorld.x <= screenSize.width*3.25/5/PTM_RATIO) {
//do something
}
else if (0 && locationWorld.x <= screenSize.width*2/5/PTM_RATIO) {
//do something else
}
}