`
caiwb1990
  • 浏览: 307819 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

9. cocos2dx 判断点是否在框内

c++ 
阅读更多
1:Node的通用方法
if(pItem->boundingBox().containsPoint(point))
{
   //do sth
}


2:other way
CCPoint pos = this->getPosition();
CCSize size = this->getContentSize();
CCRect rect(pos.x, pos.y, size.width, size.height);

if( CCRect::CCRectContainsPoint(rect, point)  )
{
    //do sth
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics