Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Crashes on Plist file load with SpriteFrameCache. Works Perfect on Android #3

Open
EvaniRam opened this issue Feb 23, 2015 · 0 comments

Comments

@EvaniRam
Copy link

Hey ,
i am trying to animate sprites from my spritesheet and accesss using Sprite Frame cache.The App crashes abruptly stating "Access Violation" in output log. i am using Cocos2d-x V3.3. I am posting the following code that i used .

//Accessing the plist file from asserts->Resources
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("myPlist.plist");

//Loading Single Image into Canvas from the Plist.
image= CCSprite::createWithSpriteFrameName("frame-1.png");
image->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
image->setScale(rX);
this->addChild(image,1);
//For Animating the Sprite

CCArray *frames = CCArray::create();

Vector<SpriteFrame*> animFrames(3);
char str[50] = {0};
for(int i = 1; i <= 3; i++)
    {
        sprintf(str, "frame-%d.png",i);
        auto frame = SpriteFrame::create(str,Rect(0,0,62,62));
         animFrames.pushBack(frame);
        /*CCString *frame = CCString::createWithFormat("frame-%d.png", i);//frame-1
        frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()-     >spriteFrameByName(frame->getCString()));*/
    }

auto animation = Animation::createWithSpriteFrames(animFrames, 0.2f);
auto animate = Animate::create(animation);
image->runAction(animate);

This code Works Perfectly on Android and IOS .IS there a problem with windows phone. i am testing on Windows Phone Emulator 512mb RAM.

Please Help me with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant