mirror of https://github.com/axmolengine/axmol.git
closed #4573: add ParticleVisibleTest.
This commit is contained in:
parent
cb1c3ccd1a
commit
9fbb45136a
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue