Projects > cpp > Issues > Bug #1526

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

TestJavascript craches on iPad, implementation of static functions needs to be placed at source file(.cpp suffix).

Bug #1526 [Closed]
zhangxm 2012-10-26 14:45 . Updated almost 12 years ago

Solution:

in CCParticleExample.h

class CC_DLL CCParticleRain : public CCParticleSystemQuad
{
public:
    CCParticleRain(){}
    virtual ~CCParticleRain(){}
    bool init(){ return initWithTotalParticles(1000); }
    virtual bool initWithTotalParticles(unsigned int numberOfParticles);
    static CCParticleRain * node()
    {
        return create();
    }
    static CCParticleRain * create()
    {
        CCParticleRain *pRet = new CCParticleRain();
        if (pRet->init())
        {
            pRet->autorelease();
            return pRet;
        }
        CC_SAFE_DELETE(pRet);
        return NULL;
    }
};

to

in in CCParticleExample.cpp

CCParticleRain* CCParticleRain::node()
{
    return CCParticleRain::create();
}

CCParticleRain* CCParticleRain::create()
{
    CCParticleRain* pRet = new CCParticleRain();
    if (pRet && pRet->init())
    {
        pRet->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pRet);
    }
    return pRet;
}
dumganhar 2012-11-01 14:14
  • Subject changed from TestJavascript craches on iPad to TestJavascript craches on iPad, implementation of static functions needs to be placed at source file(.cpp suffix).
  • Description updated (diff)
dumganhar 2012-11-02 04:17
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:769261f9875c0190e9bd3922b3f0cbf972c3d3bd.

Atom PDF

Status:Closed
Start date:2012-10-26
Priority:Normal
Due date:
Assignee:-
% Done:

100%

Category:ios
Target version:cocos2d-2.0-x-2.0.4