CCRectMake,containsPoint

来源:互联网 发布:淘宝开店需要什么条件 编辑:程序博客网 时间:2024/06/03 21:30
local item=nil
    local rect=CCRectMake(0,0,0,0)
    for row=0,self.m_rowLenght-1 do
     for  col = 1, self.m_colLenght do
      item=self.m_matrix[row * self.m_colLenght + col]
      if (item) then
       rect.origin.x=item:getPositionX()-(item:getContentSize().width / 2)
       rect.origin.y = item:getPositionY() - (item:getContentSize().height / 2)
       rect.size = item:getContentSize()
           
                if (rect:containsPoint(point)) then
                    return item
                end  
            end
        end
    end
0 0
原创粉丝点击