-(void) setIsTouchEnabled:(BOOL)enabled
{
if( isTouchEnabled_ != enabled ) {
isTouchEnabled_ = enabled;
if( isRunning_ ) {
if( enabled )
[self registerWithTouchDispatcher];
else {
CCDirector *director = [CCDirector sharedDirector];
[[director touchDispatcher] removeDelegate:self];
}
}
}
}
//这句是关键
-(void) registerWithTouchDispatcher
{
CCDirector *director = [CCDirector sharedDirector];
[[director touchDispatcher] addStandardDelegate:self priority:0];
}
接下来就实现方法:
复制代码- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
// for( UITouch *touch in touches ) {
// CGPoint location = [touch locationInView: [touch view]];
//
// location = [[CCDirector sharedDirector] convertToGL: location];
// CGPoint touchPos = location;
//
// NSLog(@"point==%@",NSStringFromCGPoint(touchPos));
// }
UITouch* touch = [touches anyObject];










