I do not know if it's going to be useful, but while we're waiting for UIGestureRecognizer to be available to iphone and /in standardTouchDelegate, this is a way to implement a standard two-touches rotation:
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([touches count] == 2) {
NSArray *twoTouches = [touches allObjects];
UITouch *first = [twoTouches objectAtIndex:0];
UITouch *second = [twoTouches objectAtIndex:1];
CGPoint a = [[CCDirector sharedDirector] convertToGL:[first previousLocationInView:[first view]]];
CGPoint ae = [[CCDirector sharedDirector] convertToGL:[first locationInView:[first view]]];
CGPoint b = [[CCDirector sharedDirector] convertToGL:[second previousLocationInView:[second view]]];
CGPoint be = [[CCDirector sharedDirector] convertToGL:[second locationInView:[first view]]];
CGPoint vector_original;
CGPoint vector_final;
if(b.y > a.y){
vector_original = ccp((b.x - a.x), (b.y - a.y));
vector_final = ccp((be.x - ae.x), (be.y - ae.y));
}
else {
vector_original = ccp((a.x - b.x), (a.y - b.y));
vector_final = ccp((ae.x - be.x), (ae.y - be.y));
}
float successive_angle = ccpAngleSigned(vector_final, vector_original));
// Do what you wish with your angle ....
}
}
It is basically just a mix of different contributions (multitouch + gesture recognizer class), but it may be useful...
Good day folks