Пример #1
0
void ColliderDetector::addContourData(ContourData *contourData)
{
    ColliderBody *colliderBody = new (std::nothrow) ColliderBody(contourData);
    _colliderBodyList.pushBack(colliderBody);
    colliderBody->release();


#if ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
    std::vector<Vec2> &calculatedVertexList = colliderBody->_calculatedVertexList;
    
    unsigned long num = contourData->vertexList.size();
    for (unsigned long i = 0; i < num; i++)
    {
        calculatedVertexList.push_back(Vec2());
    }
#endif
}
void ColliderDetector::addContourData(ContourData *contourData)
{
    ColliderBody *colliderBody = new ColliderBody(contourData);
    m_pColliderBodyList->addObject(colliderBody);
    colliderBody->release();


#if ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
    CCArray *calculatedVertexList = colliderBody->getCalculatedVertexList();
    
    int num = contourData->m_tVertexList.count();
    for (int i = 0; i < num; i++)
    {
        ContourVertex2 *newVertex = new ContourVertex2(0, 0);
        calculatedVertexList->addObject(newVertex);
        newVertex->release();
    }
#endif
}
void CCColliderDetector::addContourData(CCContourData *contourData)
{
    ColliderBody *colliderBody = new ColliderBody(contourData);
    m_pColliderBodyList->addObject(colliderBody);
    colliderBody->release();
}