cocos2d-iPhone simple function to check if the touch input was drag right
-(BOOL) icWasDragRight:(NSSet *)touches :(UIEvent *)event { NSSet *allTouches = [event allTouches]; if(2 != [allTouches count]) return FALSE; UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; CGPoint start1 = [touch previousLocationInView:[touch view]]; CGPoint end1 = [touch locationInView:[touch view]]; start1 = _icRotateRealWorld(start1); end1 = _icRotateRealWorld(end1); touch = [[allTouches allObjects] objectAtIndex:1]; CGPoint start2 = [touch previousLocationInView:[touch view]]; CGPoint end2 = [touch locationInView:[touch view]]; start2 = _icRotateRealWorld(start2); end2 = _icRotateRealWorld(end2); if(start1.x < end1.x && start2.x < end2.x) { return TRUE; } return FALSE; }
Log in to answer.
leothenerd 5:45 pm on January 3, 2010