Merge pull request #430 from natural-law/master

fixed #636
This commit is contained in:
minggo 2011-07-28 03:07:30 -07:00
commit 4d8558eec9
4 changed files with 28 additions and 26 deletions

View File

@ -1 +1 @@
9fb28c61f00c78e9def984ba0b22cf9fae814b94
5abcfaee751bdf7cdcd592e7e566090b500eddca

View File

@ -58,7 +58,7 @@ bool CCParticleFire::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
this->m_tPosition = ccp(winSize.width/2, 60);
this->setPosition(ccp(winSize.width/2, 60));
this->m_tPosVar = ccp(40, 20);
// life of particles
@ -124,7 +124,7 @@ bool CCParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
// angle
this->m_fAngle= 90;
@ -200,7 +200,7 @@ bool CCParticleSun::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
m_tPosVar = CCPointZero;
// life of particles
@ -272,7 +272,7 @@ bool CCParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
m_tPosVar = CCPointZero;
// life of particles
@ -346,7 +346,7 @@ bool CCParticleFlower::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
m_tPosVar = CCPointZero;
// life of particles
@ -419,7 +419,7 @@ bool CCParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
m_tPosVar = CCPointZero;
// life of particles
@ -493,7 +493,7 @@ bool CCParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
m_tPosVar = CCPointZero;
// life of particles
@ -566,7 +566,7 @@ bool CCParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height/2);
this->setPosition(ccp(winSize.width/2, winSize.height/2));
m_tPosVar = CCPointZero;
// life of particles
@ -636,7 +636,7 @@ bool CCParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, 0);
this->setPosition(ccp(winSize.width/2, 0));
m_tPosVar = ccp(20, 0);
// life of particles
@ -705,7 +705,7 @@ bool CCParticleSnow::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height + 10);
this->setPosition(ccp(winSize.width/2, winSize.height + 10));
m_tPosVar = ccp( winSize.width/2, 0 );
// angle
@ -782,7 +782,7 @@ bool CCParticleRain::initWithTotalParticles(unsigned int numberOfParticles)
// emitter position
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_tPosition = ccp(winSize.width/2, winSize.height);
this->setPosition(ccp(winSize.width/2, winSize.height));
m_tPosVar = ccp( winSize.width/2, 0 );
// life of particles

View File

@ -199,14 +199,15 @@ bool CCParticleSystem::initWithDictionary(CCDictionary<std::string, CCObject*> *
m_fEndSizeVar = (float)atof(valueForKey("finishParticleSizeVariance", dictionary));
// position
m_tPosition.x = (float)atof(valueForKey("sourcePositionx", dictionary));
m_tPosition.y = (float)atof(valueForKey("sourcePositiony", dictionary));
m_tPosVar.x = (float)atof(valueForKey("sourcePositionVariancex", dictionary));
float x = (float)atof(valueForKey("sourcePositionx", dictionary));
float y = (float)atof(valueForKey("sourcePositiony", dictionary));
this->setPosition( ccp(x,y) );
m_tPosVar.x = (float)atof(valueForKey("sourcePositionVariancex", dictionary));
m_tPosVar.y = (float)atof(valueForKey("sourcePositionVariancey", dictionary));
// Spinning
m_fStartSpin = (float)atof(valueForKey("rotationStart", dictionary));
m_fStartSpinVar = (float)atof(valueForKey("rotationStartVariance", dictionary));
// Spinning
m_fStartSpin = (float)atof(valueForKey("rotationStart", dictionary));
m_fStartSpinVar = (float)atof(valueForKey("rotationStartVariance", dictionary));
m_fEndSpin= (float)atof(valueForKey("rotationEnd", dictionary));
m_fEndSpinVar= (float)atof(valueForKey("rotationEndVariance", dictionary));
@ -406,15 +407,15 @@ void CCParticleSystem::initParticle(tCCParticle* particle)
// Color
ccColor4F start;
start.r = clampf(m_tStartColor.r + m_tStartColorVar.r * CCRANDOM_MINUS1_1(), 0, 1);
start.g = clampf(m_tStartColor.g + m_tStartColorVar.g * CCRANDOM_MINUS1_1(), 0, 1);
start.b = clampf(m_tStartColor.b + m_tStartColorVar.b * CCRANDOM_MINUS1_1(), 0, 1);
start.r = clampf(m_tStartColor.r + m_tStartColorVar.r * CCRANDOM_MINUS1_1(), 0, 1);
start.g = clampf(m_tStartColor.g + m_tStartColorVar.g * CCRANDOM_MINUS1_1(), 0, 1);
start.b = clampf(m_tStartColor.b + m_tStartColorVar.b * CCRANDOM_MINUS1_1(), 0, 1);
start.a = clampf(m_tStartColor.a + m_tStartColorVar.a * CCRANDOM_MINUS1_1(), 0, 1);
ccColor4F end;
end.r = clampf(m_tEndColor.r + m_tEndColorVar.r * CCRANDOM_MINUS1_1(), 0, 1);
end.g = clampf(m_tEndColor.g + m_tEndColorVar.g * CCRANDOM_MINUS1_1(), 0, 1);
end.b = clampf(m_tEndColor.b + m_tEndColorVar.b * CCRANDOM_MINUS1_1(), 0, 1);
end.r = clampf(m_tEndColor.r + m_tEndColorVar.r * CCRANDOM_MINUS1_1(), 0, 1);
end.g = clampf(m_tEndColor.g + m_tEndColorVar.g * CCRANDOM_MINUS1_1(), 0, 1);
end.b = clampf(m_tEndColor.b + m_tEndColorVar.b * CCRANDOM_MINUS1_1(), 0, 1);
end.a = clampf(m_tEndColor.a + m_tEndColorVar.a * CCRANDOM_MINUS1_1(), 0, 1);
particle->color = start;
@ -424,7 +425,7 @@ void CCParticleSystem::initParticle(tCCParticle* particle)
particle->deltaColor.a = (end.a - start.a) / particle->timeToLive;
// size
float startS = m_fStartSize + m_fStartSizeVar * CCRANDOM_MINUS1_1();
float startS = m_fStartSize + m_fStartSizeVar * CCRANDOM_MINUS1_1();
startS = MAX(0, startS); // No negative value
startS *= CC_CONTENT_SCALE_FACTOR();

View File

@ -444,7 +444,8 @@ void CCTextureCache::removeTextureForKey(const char *textureKeyName)
CCTexture2D* CCTextureCache::textureForKey(const char* key)
{
return m_pTextures->objectForKey(string(key));
std::string strKey = CCFileUtils::fullPathFromRelativePath(key);
return m_pTextures->objectForKey(strKey);
}
void CCTextureCache::reloadAllTextures()