2012-08-10 18:14:04 +08:00
|
|
|
enum {
|
|
|
|
kCCParticleDurationInfinity = -1,
|
|
|
|
kCCParticleStartSizeEqualToEndSize = -1,
|
|
|
|
kCCParticleStartRadiusEqualToEndRadius = -1,
|
|
|
|
kParticleStartSizeEqualToEndSize = kCCParticleStartSizeEqualToEndSize,
|
|
|
|
kParticleDurationInfinity = kCCParticleDurationInfinity,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
kCCParticleModeGravity,
|
|
|
|
kCCParticleModeRadius,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
kCCPositionTypeFree,
|
|
|
|
kCCPositionTypeRelative,
|
|
|
|
kCCPositionTypeGrouped,
|
|
|
|
}tCCPositionType;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
kPositionTypeFree = kCCPositionTypeFree,
|
|
|
|
kPositionTypeGrouped = kCCPositionTypeGrouped,
|
|
|
|
};
|
2011-09-18 05:24:28 +08:00
|
|
|
|
2012-02-02 14:26:38 +08:00
|
|
|
class CCParticleSystem : public CCNode
|
|
|
|
{
|
|
|
|
// mode A
|
|
|
|
const CCPoint& getGravity();
|
|
|
|
void setGravity(const CCPoint& g);
|
|
|
|
float getSpeed();
|
|
|
|
void setSpeed(float speed);
|
|
|
|
float getSpeedVar();
|
|
|
|
void setSpeedVar(float speed);
|
|
|
|
float getTangentialAccel();
|
|
|
|
void setTangentialAccel(float t);
|
|
|
|
float getTangentialAccelVar();
|
|
|
|
void setTangentialAccelVar(float t);
|
|
|
|
float getRadialAccel();
|
|
|
|
void setRadialAccel(float t);
|
|
|
|
float getRadialAccelVar();
|
|
|
|
void setRadialAccelVar(float t);
|
|
|
|
|
|
|
|
// mode B
|
|
|
|
float getStartRadius();
|
|
|
|
void setStartRadius(float startRadius);
|
|
|
|
float getStartRadiusVar();
|
|
|
|
void setStartRadiusVar(float startRadiusVar);
|
|
|
|
float getEndRadius();
|
|
|
|
void setEndRadius(float endRadius);
|
|
|
|
float getEndRadiusVar();
|
|
|
|
void setEndRadiusVar(float endRadiusVar);
|
|
|
|
float getRotatePerSecond();
|
|
|
|
void setRotatePerSecond(float degrees);
|
|
|
|
float getRotatePerSecondVar();
|
|
|
|
void setRotatePerSecondVar(float degrees);
|
|
|
|
|
|
|
|
bool addParticle();
|
|
|
|
void initParticle(tCCParticle* particle);
|
|
|
|
void stopSystem();
|
|
|
|
void resetSystem();
|
|
|
|
bool isFull();
|
|
|
|
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
|
|
|
void postStep();
|
|
|
|
|
2012-08-29 17:10:06 +08:00
|
|
|
unsigned int getParticleCount();
|
|
|
|
float getDuration();
|
|
|
|
void setDuration(float d);
|
|
|
|
CCPoint getSourcePosition();
|
|
|
|
void setSourcePosition(CCPoint pos);
|
|
|
|
CCPoint getPosVar();
|
|
|
|
void setPosVar(CCPoint pos);
|
|
|
|
float getLife();
|
|
|
|
void setLife(float life);
|
|
|
|
float getLifeVar();
|
|
|
|
void setLifeVar(float lifeVar);
|
|
|
|
float getAngle();
|
|
|
|
void setAngle(float angle);
|
|
|
|
float getAngleVar();
|
|
|
|
void setAngleVar(float angle);
|
|
|
|
|
2012-08-10 18:14:04 +08:00
|
|
|
float getStartSize();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setStartSize(float size);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getStartSizeVar();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setStartSizeVar(float size);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getEndSize();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setEndSize(float size);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getEndSizeVar();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setEndSizeVar(float size);
|
|
|
|
|
2013-03-01 17:09:42 +08:00
|
|
|
void setStartColor(const ccColor4F var);
|
2012-08-10 18:14:04 +08:00
|
|
|
const ccColor4F & getStartColor();
|
2013-03-01 17:09:42 +08:00
|
|
|
void setStartColorVar(const ccColor4F var);
|
2012-08-10 18:14:04 +08:00
|
|
|
const ccColor4F & getStartColorVar();
|
2013-03-01 17:09:42 +08:00
|
|
|
void setEndColor(const ccColor4F var);
|
2012-08-10 18:14:04 +08:00
|
|
|
const ccColor4F & getEndColor();
|
2013-03-01 17:09:42 +08:00
|
|
|
void setEndColorVar(const ccColor4F var);
|
2012-08-10 18:14:04 +08:00
|
|
|
const ccColor4F & getEndColorVar();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setStartSpin(float var);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getStartSpin();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setStartSpinVar(float var);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getStartSpinVar();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setEndSpin(float var);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getEndSpin();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setEndSpinVar(float var);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getEndSpinVar();
|
2012-08-29 17:10:06 +08:00
|
|
|
void setEmissionRate(float rate);
|
2012-08-10 18:14:04 +08:00
|
|
|
float getEmissionRate();
|
|
|
|
unsigned int getTotalParticles();
|
|
|
|
|
|
|
|
bool isAutoRemoveOnFinish();
|
|
|
|
void setAutoRemoveOnFinish(bool var);
|
|
|
|
int getEmitterMode();
|
|
|
|
void setEmitterMode(int mode);
|
|
|
|
|
2012-02-02 14:26:38 +08:00
|
|
|
CCTexture2D* getTexture(void);
|
|
|
|
void setTexture(CCTexture2D* var);
|
|
|
|
|
|
|
|
ccBlendFunc getBlendFunc(void);
|
|
|
|
void setBlendFunc(ccBlendFunc var);
|
|
|
|
|
2012-06-15 17:26:11 +08:00
|
|
|
void setScale(float s);
|
|
|
|
void setRotation(float newRotation);
|
|
|
|
void setScaleX(float newScaleX);
|
|
|
|
void setScaleY(float newScaleY);
|
2012-08-10 18:14:04 +08:00
|
|
|
|
2012-06-15 17:26:11 +08:00
|
|
|
bool isActive();
|
|
|
|
bool isBlendAdditive();
|
|
|
|
void setBlendAdditive(bool value);
|
|
|
|
|
2012-08-29 17:10:06 +08:00
|
|
|
CCParticleBatchNode* getBatchNode(void);
|
|
|
|
void setBatchNode(CCParticleBatchNode* node);
|
|
|
|
tCCPositionType getPositionType(void);
|
|
|
|
void setPositionType(tCCPositionType type);
|
|
|
|
|
|
|
|
bool initWithFile(const char* plistFile);
|
|
|
|
bool initWithTotalParticles(unsigned int number);
|
|
|
|
|
2012-06-15 11:46:51 +08:00
|
|
|
static CCParticleSystem * create(const char *plistFile);
|
2011-09-18 05:24:28 +08:00
|
|
|
};
|
|
|
|
|
2012-08-10 18:14:04 +08:00
|
|
|
class CCParticleSystemQuad : public CCParticleSystem
|
|
|
|
{
|
2012-08-29 17:10:06 +08:00
|
|
|
CCParticleSystemQuad(void);
|
2012-08-10 18:14:04 +08:00
|
|
|
void postStep();
|
|
|
|
void setDisplayFrame(CCSpriteFrame* spriteFrame);
|
|
|
|
void setTexture(CCTexture2D* texture);
|
|
|
|
void setTextureWithRect(CCTexture2D *texture, const CCRect& rect);
|
|
|
|
void setBatchNode(CCParticleBatchNode* batchNode);
|
|
|
|
void setTotalParticles(unsigned int tp);
|
|
|
|
|
|
|
|
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
|
|
|
void postStep();
|
|
|
|
void setTotalParticles(unsigned int tp);
|
|
|
|
|
2012-06-15 11:46:51 +08:00
|
|
|
static CCParticleSystemQuad * create(const char *plistFile);
|
2012-09-17 14:40:42 +08:00
|
|
|
static CCParticleSystemQuad * create();
|
2011-09-28 06:15:54 +08:00
|
|
|
};
|
|
|
|
|