Created
January 23, 2013 17:54
-
-
Save sdabet/4611017 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(CCMenuItem *) itemForTouch: (UITouch *) touch | |
{ | |
CGPoint touchLocation = [touch locationInView: [touch view]]; | |
touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation]; | |
CCMenuItem* item; | |
CCARRAY_FOREACH(children_, item){ | |
// ignore invisible and disabled items: issue #779, #866 | |
if ( [item visible] && [item isEnabled] ) { | |
CGPoint local = [item convertToNodeSpace:touchLocation]; | |
CGRect r = [item rect]; | |
r.origin = CGPointZero; | |
if( CGRectContainsPoint( r, local ) ) | |
return item; | |
} | |
} | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment