fixed #523 [all] CCParticleSystemQuad::particleWithFile can't work correctly

This commit is contained in:
liswei 2011-06-14 16:27:47 +08:00
parent 23362964bb
commit 7c669cfcb4
4 changed files with 39 additions and 1 deletions

View File

@ -51,6 +51,12 @@ public:
:m_pVertices(NULL)
{}
virtual ~CCParticleSystemPoint();
/** creates an initializes a CCParticleSystemPoint from a plist file.
This plist files can be creted manually or with Particle Designer:
*/
static CCParticleSystemPoint * particleWithFile(const char *plistFile);
// super methods
virtual bool initWithTotalParticles(int numberOfParticles);
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition);

View File

@ -60,6 +60,12 @@ public:
,m_pIndices(NULL)
{}
virtual ~CCParticleSystemQuad();
/** creates an initializes a CCParticleSystemQuad from a plist file.
This plist files can be creted manually or with Particle Designer:
*/
static CCParticleSystemQuad * particleWithFile(const char *plistFile);
/** initialices the indices for the vertices*/
void initIndices();

View File

@ -60,6 +60,20 @@ CCParticleSystemPoint::~CCParticleSystemPoint()
glDeleteBuffers(1, &m_uVerticesID);
#endif
}
// implementation CCParticleSystemPoint
CCParticleSystemPoint * CCParticleSystemPoint::particleWithFile(const char *plistFile)
{
CCParticleSystemPoint *pRet = new CCParticleSystemPoint();
if (pRet && pRet->initWithFile(plistFile))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet)
return pRet;
}
void CCParticleSystemPoint::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition)
{
// place vertices and colos in array

View File

@ -32,7 +32,6 @@ THE SOFTWARE.
namespace cocos2d {
//implementation CCParticleSystemQuad
// overriding the init method
bool CCParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
{
@ -88,6 +87,19 @@ CCParticleSystemQuad::~CCParticleSystemQuad()
#endif
}
// implementation CCParticleSystemQuad
CCParticleSystemQuad * CCParticleSystemQuad::particleWithFile(const char *plistFile)
{
CCParticleSystemQuad *pRet = new CCParticleSystemQuad();
if (pRet && pRet->initWithFile(plistFile))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet)
return pRet;
}
// rect should be in Texture coordinates, not pixel coordinates
void CCParticleSystemQuad::initTexCoordsWithRect(CCRect pointRect)
{