if (FileUtils::getInstance()->isFileExist(temp))
{
auto sp = (Sprite*)(node->getChildByTag(i));
auto body = PhysicsBody::create();
auto polygons = (Array*)(Dictionary::createWithContentsOfFile(temp)->objectForKey("polygons"));
for (int j = 0; j <polygons->count(); j++)
{
auto polygon = (Array*)polygons->objectAtIndex(j);
std::vector<Point> points;
for (int k = 0; k< polygon->count(); k++)
{
log("kkkkkkkkkkkkkkkkkkkkkkkkk=%d", polygon->count());
auto str = (String*)polygon->objectAtIndex(k);
auto point = PointFromString(str->getCString());
points.push_back(point);
}
auto data = points.data();
Point* p = new Point[polygon->count()];
log("-----------------------------%d",p);
memcpy(p, data, polygon->count()*sizeof(Point));
body->addShape(PhysicsShapePolygon::create(p, polygon->count()));
log("======================================");
//紅字那里會崩 報錯r6010 -abort()has been called
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/74299.html
標籤:Cocos2d-x
上一篇:VIsual studio提示“ObjectFactory”: 不是類或命名空間名稱
下一篇:cocos2dx打包apk問題
