Found an issue where by just adding the PhysicsShapeCache.h and PhysicsShapeCache.cpp file in my Cocos2D-x project and compiling it kept throwing C2059 error message. After furher digging into the issue found there is a WINDOWS data type Polygon, this throwing compiler errors.
Fix: Just renaming the Polygon class to PolygonPE in both the .h and .cpp files and compiler was happy again. Also tested a quick POC and was able to see physics shape loading on screen.
//BEFORE:
class Polygon : public Ref....
//AFTER: Renamed to something that did not conflict with an existing data type
class PolygonPE : public Ref...
//Test to verify fix was working....
//load spritesheet created using TexturePacker
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("spritesheet.plist");
//load physics shapes created using PhysicsEditor
PhysicsShapeCache::getInstance()->addShapesWithFile("spritesheet_Physics.plist", director->getContentScaleFactor());
auto spr = Sprite::createWithSpriteFrameName("sprite.svg");
spr->setPosition(vSize.width / 2 + vOrigin.x, vSize.height / 2 + vOrigin.y);
//load physics shape from plist
auto sprBody = PhysicsShapeCache::getInstance()->createBodyWithName("sprite_shape");
spr->setPhysicsBody(sprBody);
scene->addChild(spr);
Could you please update the class to put a fix so others do not have the same issue when using the class files.
I am using VS2015, but issue can be replicated in VS2013 as well.
PS: I also tried sending you a message via your company website but not sure if it went through successfully as I was commuting with spotty cellular coverage.
Found an issue where by just adding the PhysicsShapeCache.h and PhysicsShapeCache.cpp file in my Cocos2D-x project and compiling it kept throwing C2059 error message. After furher digging into the issue found there is a WINDOWS data type Polygon, this throwing compiler errors.
Fix: Just renaming the
Polygon
class toPolygonPE
in both the .h and .cpp files and compiler was happy again. Also tested a quick POC and was able to see physics shape loading on screen.Could you please update the class to put a fix so others do not have the same issue when using the class files.
I am using VS2015, but issue can be replicated in VS2013 as well.
PS: I also tried sending you a message via your company website but not sure if it went through successfully as I was commuting with spotty cellular coverage.