0

I have a xml-string(not the xml-file). How can I create a cocos2dx's particle-system by this xml-string? Someone can help me. Thank you very much!!

minji_LT
  • 458
  • 1
  • 6
  • 17

2 Answers2

0
CCParticleSystem *pRet = new CCParticleSystem();
if(pRet)
{
    CCDictionary *dict = CCDictionary::createWithContentsOfFileThreadSafe(xmlString.c_str());
    CCAssert( dict != NULL, "Particles: file not found");

    pRet->initWithDictionary(dict);
    dict->release();
    pRet->autorelease();

    this->addChild(pRet,100);
}

Hope it will be helpful :)

PeakCoder
  • 852
  • 8
  • 20
0

It might easier to use a particle Designer and export the particle System into a plist file and use Spencer Wong's method.

m.ding
  • 3,172
  • 19
  • 27