화면에 그려진 위치에 이미지를 터치 하고싶을때 사용하시면 좋습니다.
bool Sprite_Touch(CCNode *sprite ,CCPoint point)
{
if (sprite == NULL) {
CCLog("Touch : sprite is NULL Error(1)");
}
float newY = gl_WinSizeOrige.height - point.y;
point = CCPointMake(point.x, newY);
if (CCRect::CCRectContainsPoint(sprite->boundingBox(), point)) {
return true;
}
return false;
}
CCRect::CCRectContainsPoint(sprite->boundingBox(), point)
스프라이트의 크기에 포인터가 들어 갔는지 물어 봅니다.
댓글 없음:
댓글 쓰기