closed #4573: add ParticleVisibleTest.

This commit is contained in:
boyu0 2014-03-27 17:06:26 +08:00
parent cb1c3ccd1a
commit 9fbb45136a
2 changed files with 42 additions and 1 deletions

View File

@ -1009,13 +1009,14 @@ Layer* createParticleLayer(int nIndex)
case 43: return new PremultipliedAlphaTest2();
case 44: return new Issue3990();
case 45: return new ParticleAutoBatching();
case 46: return new ParticleVisibleTest();
default:
break;
}
return NULL;
}
#define MAX_LAYER 46
#define MAX_LAYER 47
Layer* nextParticleAction()
@ -1939,6 +1940,37 @@ std::string Issue3990::subtitle() const
}
// ParticleVisibleTest
void ParticleVisibleTest::onEnter()
{
ParticleDemo::onEnter();
_emitter = ParticleFireworks::create();
_emitter->retain();
_background->addChild(_emitter, 10);
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) );
schedule(schedule_selector(ParticleVisibleTest::callback), 1);
setEmitterPosition();
}
std::string ParticleVisibleTest::title() const
{
return "Issue4573";
}
std::string ParticleVisibleTest::subtitle() const
{
return "Visible enable/disable";
}
void ParticleVisibleTest::callback(float delta)
{
_emitter->setVisible(!_emitter->isVisible());
}
//
// ParticleAutoBatching
//

View File

@ -310,6 +310,15 @@ public:
virtual std::string subtitle() const override;
};
class ParticleVisibleTest : public ParticleDemo
{
public:
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
void callback(float delta);
};
class ParticleAutoBatching : public ParticleDemo
{
public: