Projects > cpp > Issues > Bug #4374

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

Create Issue on Github

ParticleSystemQuad::setDisplayFrame could not work correctly

Bug #4374 [Closed]
dumganhar 2014-03-13 09:16 . Updated over 10 years ago

It didn't consider the rect of spriteframe.

Reproduce Step:

    auto particle = ParticleSystemQuad::create("Particles/SpinningPeas.plist");
    particle->setSpriteFrame(SpriteFrame::create("xxx.png", Rect(10, 10, 20, 20)); // The rect can't take effect.
    particle->setPosition(VisibleRect::center());

    this->addChild(particle ,10);

Patch is bellow:

+void ParticleSystemQuad::setSpriteFrame(SpriteFrame *spriteFrame)
 {
    CCASSERT(spriteFrame->getOffsetInPixels().equals(Point::ZERO), 
             "QuadParticle only supports SpriteFrames with no offsets");

     // update texture before updating texture rect
     if ( !_texture || spriteFrame->getTexture()->getName() != _texture->getName())
     {
-        this->setTexture(spriteFrame->getTexture());
+        this->setTextureWithRect(spriteFrame->getTexture(), spriteFrame->getRect());
     }
 }

walzer@cocos2d-x.org 2014-10-08 02:45

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8360

Atom PDF

Status:Closed
Start date:2014-03-13
Priority:Normal
Due date:
Assignee:boyu0
% Done:

0%

Category:all
Target version:Candidate