2011-03-19 10:07:16 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010-2011 cocos2d-x.org
|
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
2011-07-04 19:20:16 +08:00
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2011-03-19 10:07:16 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __CCPARTICLE_EXAMPLE_H__
|
|
|
|
#define __CCPARTICLE_EXAMPLE_H__
|
|
|
|
|
2012-04-25 16:18:04 +08:00
|
|
|
#include "CCParticleSystemQuad.h"
|
2011-03-19 10:07:16 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
NS_CC_BEGIN
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup particle_nodes
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A fire particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleFire : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleFire(){}
|
|
|
|
virtual ~CCParticleFire(){}
|
|
|
|
bool init(){ return initWithTotalParticles(250); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleFire * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
static CCParticleFire * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleFire *pRet = new CCParticleFire();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A fireworks particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleFireworks : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleFireworks(){}
|
|
|
|
virtual ~CCParticleFireworks(){}
|
|
|
|
bool init(){ return initWithTotalParticles(1500); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleFireworks * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
static CCParticleFireworks * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleFireworks *pRet = new CCParticleFireworks();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A sun particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleSun : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleSun(){}
|
|
|
|
virtual ~CCParticleSun(){}
|
|
|
|
bool init(){ return initWithTotalParticles(350); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleSun * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCParticleSun * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleSun *pRet = new CCParticleSun();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A galaxy particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleGalaxy : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleGalaxy(){}
|
|
|
|
virtual ~CCParticleGalaxy(){}
|
|
|
|
bool init(){ return initWithTotalParticles(200); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleGalaxy * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
static CCParticleGalaxy * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleGalaxy *pRet = new CCParticleGalaxy();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A flower particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleFlower : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleFlower(){}
|
|
|
|
virtual ~CCParticleFlower(){}
|
|
|
|
bool init(){ return initWithTotalParticles(250); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleFlower * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
static CCParticleFlower * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleFlower *pRet = new CCParticleFlower();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A meteor particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleMeteor : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleMeteor(){}
|
|
|
|
virtual ~CCParticleMeteor(){}
|
|
|
|
bool init(){ return initWithTotalParticles(150); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleMeteor * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCParticleMeteor * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleMeteor *pRet = new CCParticleMeteor();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief An spiral particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleSpiral : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleSpiral(){}
|
|
|
|
virtual ~CCParticleSpiral(){}
|
|
|
|
bool init(){ return initWithTotalParticles(500); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleSpiral * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCParticleSpiral * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleSpiral *pRet = new CCParticleSpiral();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief An explosion particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleExplosion : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleExplosion(){}
|
|
|
|
virtual ~CCParticleExplosion(){}
|
|
|
|
bool init(){ return initWithTotalParticles(700); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleExplosion * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCParticleExplosion * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleExplosion *pRet = new CCParticleExplosion();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief An smoke particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleSmoke : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleSmoke(){}
|
|
|
|
virtual ~CCParticleSmoke(){}
|
|
|
|
bool init(){ return initWithTotalParticles(200); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleSmoke * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCParticleSmoke * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleSmoke *pRet = new CCParticleSmoke();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief An snow particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleSnow : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleSnow(){}
|
|
|
|
virtual ~CCParticleSnow(){}
|
|
|
|
bool init(){ return initWithTotalParticles(700); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleSnow * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
|
|
|
|
static CCParticleSnow * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleSnow *pRet = new CCParticleSnow();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2010-08-23 14:57:37 +08:00
|
|
|
|
2010-12-28 14:04:28 +08:00
|
|
|
//! @brief A rain particle system
|
2012-04-25 16:18:04 +08:00
|
|
|
class CC_DLL CCParticleRain : public CCParticleSystemQuad
|
2010-12-28 14:04:28 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCParticleRain(){}
|
|
|
|
virtual ~CCParticleRain(){}
|
|
|
|
bool init(){ return initWithTotalParticles(1000); }
|
|
|
|
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
2012-06-14 17:29:23 +08:00
|
|
|
static CCParticleRain * node()
|
|
|
|
{
|
|
|
|
return create();
|
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCParticleRain * create()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCParticleRain *pRet = new CCParticleRain();
|
|
|
|
if (pRet->init())
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
CC_SAFE_DELETE(pRet);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-28 14:04:28 +08:00
|
|
|
};
|
2011-03-19 10:07:16 +08:00
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of particle_nodes group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
NS_CC_END
|
2011-03-19 10:07:16 +08:00
|
|
|
|
|
|
|
#endif //__CCPARTICLE_EXAMPLE_H__
|