axmol/tests/cpp-tests/Classes/ParticleTest/ParticleTest.h

376 lines
8.8 KiB
C
Raw Normal View History

2010-08-23 16:38:10 +08:00
#ifndef _PARTICLE_TEST_H_
#define _PARTICLE_TEST_H_
2012-04-04 21:58:04 +08:00
#include "../BaseTest.h"
2012-04-04 21:58:04 +08:00
DEFINE_TEST_SUITE(ParticleTests);
2012-04-04 21:58:04 +08:00
class ParticleDemo : public TestCase
2010-08-23 16:38:10 +08:00
{
2012-04-04 21:58:04 +08:00
protected:
cocos2d::ParticleSystemQuad* _emitter;
cocos2d::Sprite* _background;
cocos2d::LayerColor* _color;
2012-04-04 21:58:04 +08:00
public:
~ParticleDemo(void);
2012-04-04 21:58:04 +08:00
virtual void onEnter(void);
2010-08-23 16:38:10 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
void toggleCallback(cocos2d::Ref* sender);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
2010-08-23 16:38:10 +08:00
virtual void update(float dt) override;
void setEmitterPosition();
2010-08-23 16:38:10 +08:00
};
class DemoFirework : public ParticleDemo
{
public:
CREATE_FUNC(DemoFirework);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoFire : public ParticleDemo
{
public:
CREATE_FUNC(DemoFire);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoSun : public ParticleDemo
{
public:
CREATE_FUNC(DemoSun);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoGalaxy : public ParticleDemo
{
public:
CREATE_FUNC(DemoGalaxy);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoFlower : public ParticleDemo
{
public:
CREATE_FUNC(DemoFlower);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoBigFlower : public ParticleDemo
{
public:
CREATE_FUNC(DemoBigFlower);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoRotFlower : public ParticleDemo
{
public:
CREATE_FUNC(DemoRotFlower);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoMeteor : public ParticleDemo
{
public:
CREATE_FUNC(DemoMeteor);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoSpiral : public ParticleDemo
{
public:
CREATE_FUNC(DemoSpiral);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoExplosion : public ParticleDemo
{
public:
CREATE_FUNC(DemoExplosion);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoSmoke : public ParticleDemo
{
public:
CREATE_FUNC(DemoSmoke);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoSnow : public ParticleDemo
{
public:
CREATE_FUNC(DemoSnow);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoRain : public ParticleDemo
{
public:
CREATE_FUNC(DemoRain);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoModernArt : public ParticleDemo
{
public:
CREATE_FUNC(DemoModernArt);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class DemoRing : public ParticleDemo
{
public:
CREATE_FUNC(DemoRing);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
class ParallaxParticle : public ParticleDemo
{
public:
CREATE_FUNC(ParallaxParticle);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-23 16:38:10 +08:00
};
2010-08-26 09:55:54 +08:00
2012-04-04 21:58:04 +08:00
class DemoParticleFromFile : public ParticleDemo
{
public:
static DemoParticleFromFile* create(const std::string& file)
{
auto ret = new (std::nothrow) DemoParticleFromFile;
if (ret && ret->init())
{
ret->_title = file;
ret->autorelease();
}
else
{
delete ret;
ret = nullptr;
}
return ret;
2012-04-04 21:58:04 +08:00
}
std::string _title;
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override
2012-04-04 21:58:04 +08:00
{
return _title;
2012-04-04 21:58:04 +08:00
}
2010-08-26 09:55:54 +08:00
};
class RadiusMode1 : public ParticleDemo
{
public:
CREATE_FUNC(RadiusMode1);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
};
2012-04-04 21:58:04 +08:00
class RadiusMode2 : public ParticleDemo
{
public:
CREATE_FUNC(RadiusMode2);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2012-04-04 21:58:04 +08:00
};
class Issue704 : public ParticleDemo
{
public:
CREATE_FUNC(Issue704);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-04-04 21:58:04 +08:00
};
class Issue870 : public ParticleDemo
{
public:
CREATE_FUNC(Issue870);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-06-08 13:55:28 +08:00
void updateQuads(float dt);
private:
int _index;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class Issue1201 : public ParticleDemo
{
public:
CREATE_FUNC(Issue1201);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class ParticleBatchHybrid : public ParticleDemo
{
public:
CREATE_FUNC(ParticleBatchHybrid);
virtual void onEnter() override;
2012-06-08 13:55:28 +08:00
void switchRender(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-03-22 18:29:07 +08:00
private:
cocos2d::Node* _parent1;
cocos2d::Node* _parent2;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class ParticleBatchMultipleEmitters : public ParticleDemo
{
public:
CREATE_FUNC(ParticleBatchMultipleEmitters);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class ParticleReorder : public ParticleDemo
{
public:
CREATE_FUNC(ParticleReorder);
virtual void onEnter() override;
2012-06-08 13:55:28 +08:00
void reorderParticles(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-03-22 18:29:07 +08:00
private:
unsigned int _order;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class MultipleParticleSystems : public ParticleDemo
{
public:
CREATE_FUNC(MultipleParticleSystems);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void update(float dt) override;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class MultipleParticleSystemsBatched : public ParticleDemo
{
public:
CREATE_FUNC(MultipleParticleSystemsBatched);
virtual void onEnter() override;
virtual void update(float dt) override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class AddAndDeleteParticleSystems : public ParticleDemo
{
public:
CREATE_FUNC(AddAndDeleteParticleSystems);
virtual void onEnter() override;
virtual void update(float dt) override;
2012-06-08 13:55:28 +08:00
void removeSystem(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-03-22 18:29:07 +08:00
private:
cocos2d::ParticleBatchNode* _batchNode;
2012-04-04 21:58:04 +08:00
};
2012-03-22 18:29:07 +08:00
class ReorderParticleSystems : public ParticleDemo
{
public:
CREATE_FUNC(ReorderParticleSystems);
virtual void onEnter() override;
2012-06-08 13:55:28 +08:00
void reorderSystem(float time);
virtual void update(float dt) override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-03-22 18:29:07 +08:00
private:
cocos2d::ParticleBatchNode* _batchNode;
2012-04-04 21:58:04 +08:00
};
2012-06-12 15:40:31 +08:00
class PremultipliedAlphaTest : public ParticleDemo
{
bool _hasEmitter;
2012-06-12 15:40:31 +08:00
public:
CREATE_FUNC(PremultipliedAlphaTest);
virtual void onEnter() override;
void readdPaticle(float delta);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-06-12 15:40:31 +08:00
};
class PremultipliedAlphaTest2 : public ParticleDemo
{
public:
CREATE_FUNC(PremultipliedAlphaTest2);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Issue3990 : public ParticleDemo
{
public:
CREATE_FUNC(Issue3990);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-06-12 15:40:31 +08:00
};
2014-03-27 17:06:26 +08:00
class ParticleVisibleTest : public ParticleDemo
{
public:
CREATE_FUNC(ParticleVisibleTest);
2014-03-27 17:06:26 +08:00
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:
CREATE_FUNC(ParticleAutoBatching);
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2014-07-29 11:21:11 +08:00
class ParticleResetTotalParticles : public ParticleDemo
{
public:
CREATE_FUNC(ParticleResetTotalParticles);
2014-07-29 11:21:11 +08:00
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2012-04-04 21:58:04 +08:00
#endif