axmol/cocos2dx/include/CCParticleExamples.h

266 lines
6.8 KiB
C
Raw Normal View History

2010-08-23 14:57:37 +08:00
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
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__
#include "CCPointParticleSystem.h"
#include "CCQuadParticleSystem.h"
namespace cocos2d {
//! @brief A fire particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleFire : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleFire(){}
virtual ~CCParticleFire(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(250); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleFire * node()
{
CCParticleFire *pRet = new CCParticleFire();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief A fireworks particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleFireworks : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleFireworks(){}
virtual ~CCParticleFireworks(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(1500); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleFireworks * node()
{
CCParticleFireworks *pRet = new CCParticleFireworks();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief A sun particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleSun : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleSun(){}
virtual ~CCParticleSun(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(350); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleSun * node()
{
CCParticleSun *pRet = new CCParticleSun();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief A galaxy particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleGalaxy : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleGalaxy(){}
virtual ~CCParticleGalaxy(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(200); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleGalaxy * node()
{
CCParticleGalaxy *pRet = new CCParticleGalaxy();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief A flower particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleFlower : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleFlower(){}
virtual ~CCParticleFlower(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(250); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleFlower * node()
{
CCParticleFlower *pRet = new CCParticleFlower();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief A meteor particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleMeteor : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleMeteor(){}
virtual ~CCParticleMeteor(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(150); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleMeteor * node()
{
CCParticleMeteor *pRet = new CCParticleMeteor();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief An spiral particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleSpiral : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleSpiral(){}
virtual ~CCParticleSpiral(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(500); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleSpiral * node()
{
CCParticleSpiral *pRet = new CCParticleSpiral();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief An explosion particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleExplosion : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleExplosion(){}
virtual ~CCParticleExplosion(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(700); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleExplosion * node()
{
CCParticleExplosion *pRet = new CCParticleExplosion();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief An smoke particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleSmoke : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleSmoke(){}
virtual ~CCParticleSmoke(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(200); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleSmoke * node()
{
CCParticleSmoke *pRet = new CCParticleSmoke();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief An snow particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleSnow : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleSnow(){}
virtual ~CCParticleSnow(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(700); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleSnow * node()
{
CCParticleSnow *pRet = new CCParticleSnow();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
//! @brief A rain particle system
2010-08-23 15:56:14 +08:00
class CCX_DLL CCParticleRain : public CCQuadParticleSystem
2010-08-23 14:57:37 +08:00
{
2010-08-23 15:53:10 +08:00
public:
2010-08-23 14:57:37 +08:00
CCParticleRain(){}
virtual ~CCParticleRain(){}
2010-08-23 15:53:10 +08:00
bool init(){ return initWithTotalParticles(1000); }
2010-08-23 14:57:37 +08:00
virtual bool initWithTotalParticles(int numberOfParticles);
2010-08-23 15:15:05 +08:00
static CCParticleRain * node()
{
CCParticleRain *pRet = new CCParticleRain();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CCX_SAFE_DELETE(pRet)
2010-08-23 15:15:05 +08:00
return NULL;
}
2010-08-23 14:57:37 +08:00
};
}// namespace cocos2d
#endif //__CCPARTICLE_EXAMPLE_H__