Beispiel #1
0
bool TeachLayer::checkChildType(cocos2d::Node *pNode, cocos2d::Rect stencilRect)
{
    if (!pNode) return false;
    if (0 >= pNode->getChildrenCount()) return false;
    
    for (auto child : pNode->getChildren())
    {
        if (dynamic_cast<SpriteButton*>(child))
        {
            auto spriteButton = dynamic_cast<SpriteButton*>(child);
            Rect btnRect = getNodeRect(spriteButton);
            if (stencilRect.intersectsRect(btnRect))
            {
                removeFromParent();
//                spriteButton->execCallBackEvent();
                return true;
            }
        }
    }
    
    for (auto child : pNode->getChildren())
    {
        if (checkChildType(child, stencilRect))
            return true;
    }
    return false;
}
Beispiel #2
0
void TableView::getShowCells(const cocos2d::Rect& area, std::vector<uint16_t>* dst)
{
	Rect _cellRect;
	for (int i = 0; i < m_totalCnt; ++i)
	{
		getCellRect(i, &_cellRect);
		if (!area.intersectsRect(_cellRect))
			continue;
		dst->push_back(i);
	}
}