mirror of https://github.com/axmolengine/axmol.git
commit
92b180080c
File diff suppressed because it is too large
Load Diff
|
@ -102,7 +102,7 @@ bool ParticleBatchNode::initWithTexture(Texture2D *tex, int capacity)
|
|||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
|
||||
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ void ParticleBatchNode::visit()
|
|||
transform();
|
||||
|
||||
draw();
|
||||
|
||||
|
||||
if ( _grid && _grid->isActive())
|
||||
{
|
||||
_grid->afterDraw(this);
|
||||
|
@ -171,12 +171,12 @@ void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag)
|
|||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||
CCASSERT( child->getTexture()->getName() == _textureAtlas->getTexture()->getName(), "CCParticleSystem is not using the same texture id");
|
||||
// If this is the 1st children, then copy blending function
|
||||
if( _children->count() == 0 )
|
||||
if( _children->count() == 0 )
|
||||
{
|
||||
setBlendFunc(child->getBlendFunc());
|
||||
}
|
||||
|
||||
CCASSERT( _blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst, "Can't add a PaticleSystem that uses a different blending function");
|
||||
CCASSERT( _blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst, "Can't add a ParticleSystem that uses a different blending function");
|
||||
|
||||
//no lazy sorting, so don't call super addChild, call helper instead
|
||||
unsigned int pos = addChildHelper(child,zOrder,tag);
|
||||
|
@ -184,7 +184,7 @@ void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag)
|
|||
//get new atlasIndex
|
||||
int atlasIndex = 0;
|
||||
|
||||
if (pos != 0)
|
||||
if (pos != 0)
|
||||
{
|
||||
ParticleSystem* p = (ParticleSystem*)_children->getObjectAtIndex(pos-1);
|
||||
atlasIndex = p->getAtlasIndex() + p->getTotalParticles();
|
||||
|
@ -210,7 +210,7 @@ unsigned int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int
|
|||
CCASSERT( child != NULL, "Argument must be non-nil");
|
||||
CCASSERT( child->getParent() == NULL, "child already added. It can't be added again");
|
||||
|
||||
if( ! _children )
|
||||
if( ! _children )
|
||||
{
|
||||
_children = new Array();
|
||||
_children->initWithCapacity(4);
|
||||
|
@ -226,7 +226,7 @@ unsigned int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int
|
|||
|
||||
child->setParent(this);
|
||||
|
||||
if( _running )
|
||||
if( _running )
|
||||
{
|
||||
child->onEnter();
|
||||
child->onEnterTransitionDidFinish();
|
||||
|
@ -243,7 +243,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder)
|
|||
|
||||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||
|
||||
if( zOrder == child->getZOrder() )
|
||||
if( zOrder == child->getZOrder() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder)
|
|||
for( int i=0;i < _children->count();i++)
|
||||
{
|
||||
ParticleSystem* pNode = (ParticleSystem*)_children->getObjectAtIndex(i);
|
||||
if( pNode == child )
|
||||
if( pNode == child )
|
||||
{
|
||||
newAtlasIndex = child->getAtlasIndex();
|
||||
break;
|
||||
|
@ -300,12 +300,12 @@ void ParticleBatchNode::getCurrentIndex(unsigned int* oldIndex, unsigned int* ne
|
|||
int minusOne = 0;
|
||||
unsigned int count = _children->count();
|
||||
|
||||
for( unsigned int i=0; i < count; i++ )
|
||||
for( unsigned int i=0; i < count; i++ )
|
||||
{
|
||||
Node* pNode = (Node *)_children->getObjectAtIndex(i);
|
||||
|
||||
// new index
|
||||
if( pNode->getZOrder() > z && ! foundNewIdx )
|
||||
if( pNode->getZOrder() > z && ! foundNewIdx )
|
||||
{
|
||||
*newIndex = i;
|
||||
foundNewIdx = true;
|
||||
|
@ -317,7 +317,7 @@ void ParticleBatchNode::getCurrentIndex(unsigned int* oldIndex, unsigned int* ne
|
|||
}
|
||||
|
||||
// current index
|
||||
if( child == pNode )
|
||||
if( child == pNode )
|
||||
{
|
||||
*oldIndex = i;
|
||||
foundCurrentIdx = true;
|
||||
|
@ -347,7 +347,7 @@ unsigned int ParticleBatchNode::searchNewPositionInChildrenForZ(int z)
|
|||
{
|
||||
unsigned int count = _children->count();
|
||||
|
||||
for( unsigned int i=0; i < count; i++ )
|
||||
for( unsigned int i=0; i < count; i++ )
|
||||
{
|
||||
Node *child = (Node *)_children->getObjectAtIndex(i);
|
||||
if (child->getZOrder() > z)
|
||||
|
@ -364,7 +364,7 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup)
|
|||
// explicit nil handling
|
||||
if (aChild == NULL)
|
||||
return;
|
||||
|
||||
|
||||
CCASSERT( dynamic_cast<ParticleSystem*>(aChild) != NULL, "CCParticleBatchNode only supports QuadParticleSystems as children");
|
||||
CCASSERT(_children->containsObject(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it");
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ void ArmatureTestLayer::onExit()
|
|||
removeAllChildren();
|
||||
|
||||
backItem = restartItem = nextItem = nullptr;
|
||||
|
||||
|
||||
Layer::onExit();
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ void TestPerformance::onEnter()
|
|||
decrease->setColor(Color3B(0,200,20));
|
||||
MenuItemFont *increase = MenuItemFont::create(" + ", CC_CALLBACK_1(TestPerformance::onIncrease, this));
|
||||
increase->setColor(Color3B(0,200,20));
|
||||
|
||||
|
||||
Menu *menu = Menu::create(decrease, increase, nullptr);
|
||||
menu->alignItemsHorizontally();
|
||||
menu->setPosition(Point(VisibleRect::getVisibleRect().size.width/2, VisibleRect::getVisibleRect().size.height-100));
|
||||
|
@ -404,7 +404,7 @@ void TestPerformance::onDecrease(Object* pSender)
|
|||
{
|
||||
removeArmatureFromParent(ArmaturePerformanceTag + armatureCount);
|
||||
armatureCount --;
|
||||
refreshTitile();
|
||||
refreshTitle();
|
||||
}
|
||||
}
|
||||
void TestPerformance::addArmature(int number)
|
||||
|
@ -423,7 +423,7 @@ void TestPerformance::addArmature(int number)
|
|||
armature->release();
|
||||
}
|
||||
|
||||
refreshTitile();
|
||||
refreshTitle();
|
||||
}
|
||||
void TestPerformance::addArmatureToParent(cocostudio::Armature *armature)
|
||||
{
|
||||
|
@ -433,7 +433,7 @@ void TestPerformance::removeArmatureFromParent(int tag)
|
|||
{
|
||||
removeChildByTag(ArmaturePerformanceTag + armatureCount);
|
||||
}
|
||||
void TestPerformance::refreshTitile()
|
||||
void TestPerformance::refreshTitle()
|
||||
{
|
||||
char pszCount[255];
|
||||
sprintf(pszCount, "%s %i", subtitle().c_str(), armatureCount);
|
||||
|
@ -601,7 +601,7 @@ void TestFrameEvent::onFrameEvent(Bone *bone, const char *evt, int originFrameIn
|
|||
{
|
||||
this->stopAllActions();
|
||||
|
||||
ActionInterval *action = ShatteredTiles3D::create(0.2f, Size(16,12), 5, false);
|
||||
ActionInterval *action = ShatteredTiles3D::create(0.2f, Size(16,12), 5, false);
|
||||
action->setTag(FRAME_EVENT_ACTION_TAG);
|
||||
this->runAction(action);
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ void TestFrameEvent::checkAction(float dt)
|
|||
void TestParticleDisplay::onEnter()
|
||||
{
|
||||
ArmatureTestLayer::onEnter();
|
||||
|
||||
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(TestParticleDisplay::onTouchesEnded, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
@ -681,7 +681,7 @@ void TestUseMutiplePicture::onEnter()
|
|||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(TestUseMutiplePicture::onTouchesEnded, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
|
||||
displayIndex = 0;
|
||||
|
||||
armature = Armature::create("Knight_f/Knight");
|
||||
|
@ -1076,7 +1076,7 @@ std::string TestAnchorPoint::title()
|
|||
void TestArmatureNesting::onEnter()
|
||||
{
|
||||
ArmatureTestLayer::onEnter();
|
||||
|
||||
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(TestArmatureNesting::onTouchesEnded, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
@ -1241,7 +1241,7 @@ void TestArmatureNesting2::onTouchesEnded(const std::vector<Touch*>& touches, Ev
|
|||
{
|
||||
Point point = touches[0]->getLocation();
|
||||
|
||||
Armature *armature = hero->getMount() == nullptr ? hero : hero->getMount();
|
||||
Armature *armature = hero->getMount() == nullptr ? hero : hero->getMount();
|
||||
|
||||
//Set armature direction
|
||||
if (point.x < armature->getPositionX())
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
class ArmatureTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ArmatureTestScene(bool bPortrait = false);
|
||||
|
||||
virtual void runThisTest();
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
virtual void addArmature(int number);
|
||||
virtual void addArmatureToParent(cocostudio::Armature *armature);
|
||||
virtual void removeArmatureFromParent(int tag);
|
||||
virtual void refreshTitile();
|
||||
virtual void refreshTitle();
|
||||
|
||||
int armatureCount;
|
||||
|
||||
|
@ -327,4 +327,4 @@ public:
|
|||
|
||||
bool touchedMenu;
|
||||
};
|
||||
#endif // __HELLOWORLD_SCENE_H__
|
||||
#endif // __HELLOWORLD_SCENE_H__
|
||||
|
|
|
@ -21,9 +21,9 @@ void DemoFirework::onEnter()
|
|||
_emitter = ParticleFireworks::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,11 @@ void DemoFire::onEnter()
|
|||
_emitter = ParticleFire::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );//.pvr");
|
||||
auto p = _emitter->getPosition();
|
||||
_emitter->setPosition( Point(p.x, 100) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ void DemoSun::onEnter()
|
|||
_background->addChild(_emitter, 10);
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -93,10 +93,10 @@ void DemoGalaxy::onEnter()
|
|||
_emitter = ParticleGalaxy::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
setEmitterPosition();
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
std::string DemoGalaxy::title()
|
||||
|
@ -117,7 +117,7 @@ void DemoFlower::onEnter()
|
|||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -143,61 +143,61 @@ void DemoBigFlower::onEnter()
|
|||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) );
|
||||
|
||||
_emitter->setDuration(-1);
|
||||
|
||||
|
||||
// gravity
|
||||
_emitter->setGravity(Point::ZERO);
|
||||
|
||||
|
||||
// angle
|
||||
_emitter->setAngle(90);
|
||||
_emitter->setAngleVar(360);
|
||||
|
||||
|
||||
// speed of particles
|
||||
_emitter->setSpeed(160);
|
||||
_emitter->setSpeedVar(20);
|
||||
|
||||
|
||||
// radial
|
||||
_emitter->setRadialAccel(-120);
|
||||
_emitter->setRadialAccelVar(0);
|
||||
|
||||
|
||||
// tagential
|
||||
_emitter->setTangentialAccel(30);
|
||||
_emitter->setTangentialAccelVar(0);
|
||||
|
||||
|
||||
// emitter position
|
||||
_emitter->setPosition( Point(160,240) );
|
||||
_emitter->setPosVar(Point::ZERO);
|
||||
|
||||
|
||||
// life of particles
|
||||
_emitter->setLife(4);
|
||||
_emitter->setLifeVar(1);
|
||||
|
||||
|
||||
// spin of particles
|
||||
_emitter->setStartSpin(0);
|
||||
_emitter->setStartSizeVar(0);
|
||||
_emitter->setEndSpin(0);
|
||||
_emitter->setEndSpinVar(0);
|
||||
|
||||
|
||||
// color of particles
|
||||
Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
_emitter->setStartColor(startColor);
|
||||
|
||||
|
||||
Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
_emitter->setStartColorVar(startColorVar);
|
||||
|
||||
|
||||
Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColor(endColor);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColorVar(endColorVar);
|
||||
|
||||
|
||||
// size, in pixels
|
||||
_emitter->setStartSize(80.0f);
|
||||
_emitter->setStartSizeVar(40.0f);
|
||||
_emitter->setEndSize(ParticleSystem::START_SIZE_EQUAL_TO_END_SIZE);
|
||||
|
||||
|
||||
// emits per second
|
||||
_emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife());
|
||||
|
||||
|
||||
// additive
|
||||
_emitter->setBlendAdditive(true);
|
||||
|
||||
|
@ -224,33 +224,33 @@ void DemoRotFlower::onEnter()
|
|||
_background->addChild(_emitter, 10);
|
||||
////_emitter->release(); // win32 : Remove this line
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars2) );
|
||||
|
||||
|
||||
// duration
|
||||
_emitter->setDuration(-1);
|
||||
|
||||
|
||||
// gravity
|
||||
_emitter->setGravity(Point::ZERO);
|
||||
|
||||
|
||||
// angle
|
||||
_emitter->setAngle(90);
|
||||
_emitter->setAngleVar(360);
|
||||
|
||||
|
||||
// speed of particles
|
||||
_emitter->setSpeed(160);
|
||||
_emitter->setSpeedVar(20);
|
||||
|
||||
|
||||
// radial
|
||||
_emitter->setRadialAccel(-120);
|
||||
_emitter->setRadialAccelVar(0);
|
||||
|
||||
|
||||
// tagential
|
||||
_emitter->setTangentialAccel(30);
|
||||
_emitter->setTangentialAccelVar(0);
|
||||
|
||||
|
||||
// emitter position
|
||||
_emitter->setPosition( Point(160,240) );
|
||||
_emitter->setPosVar(Point::ZERO);
|
||||
|
||||
|
||||
// life of particles
|
||||
_emitter->setLife(3);
|
||||
_emitter->setLifeVar(1);
|
||||
|
@ -260,31 +260,31 @@ void DemoRotFlower::onEnter()
|
|||
_emitter->setStartSpinVar(0);
|
||||
_emitter->setEndSpin(0);
|
||||
_emitter->setEndSpinVar(2000);
|
||||
|
||||
|
||||
// color of particles
|
||||
Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
_emitter->setStartColor(startColor);
|
||||
|
||||
|
||||
Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
_emitter->setStartColorVar(startColorVar);
|
||||
|
||||
|
||||
Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColor(endColor);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
_emitter->setStartSize(30.0f);
|
||||
_emitter->setStartSizeVar(00.0f);
|
||||
_emitter->setEndSize(ParticleSystem::START_SIZE_EQUAL_TO_END_SIZE);
|
||||
|
||||
|
||||
// emits per second
|
||||
_emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife());
|
||||
|
||||
// additive
|
||||
_emitter->setBlendAdditive(false);
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -305,9 +305,9 @@ void DemoMeteor::onEnter()
|
|||
_emitter = ParticleMeteor::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -328,9 +328,9 @@ void DemoSpiral::onEnter()
|
|||
_emitter = ParticleSpiral::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -351,11 +351,11 @@ void DemoExplosion::onEnter()
|
|||
_emitter = ParticleExplosion::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_stars1) );
|
||||
|
||||
|
||||
_emitter->setAutoRemoveOnFinish(true);
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -377,10 +377,10 @@ void DemoSmoke::onEnter()
|
|||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
auto p = _emitter->getPosition();
|
||||
_emitter->setPosition( Point( p.x, 100) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -401,34 +401,34 @@ void DemoSnow::onEnter()
|
|||
_emitter = ParticleSnow::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
auto p = _emitter->getPosition();
|
||||
_emitter->setPosition( Point( p.x, p.y-110) );
|
||||
_emitter->setLife(3);
|
||||
_emitter->setLifeVar(1);
|
||||
|
||||
|
||||
// gravity
|
||||
_emitter->setGravity(Point(0,-10));
|
||||
|
||||
|
||||
// speed of particles
|
||||
_emitter->setSpeed(130);
|
||||
_emitter->setSpeedVar(30);
|
||||
|
||||
|
||||
|
||||
|
||||
Color4F startColor = _emitter->getStartColor();
|
||||
startColor.r = 0.9f;
|
||||
startColor.g = 0.9f;
|
||||
startColor.b = 0.9f;
|
||||
_emitter->setStartColor(startColor);
|
||||
|
||||
|
||||
Color4F startColorVar = _emitter->getStartColorVar();
|
||||
startColorVar.b = 0.1f;
|
||||
_emitter->setStartColorVar(startColorVar);
|
||||
|
||||
|
||||
_emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife());
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_snow) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -449,13 +449,13 @@ void DemoRain::onEnter()
|
|||
_emitter = ParticleRain::create();
|
||||
_emitter->retain();
|
||||
_background->addChild(_emitter, 10);
|
||||
|
||||
|
||||
auto p = _emitter->getPosition();
|
||||
_emitter->setPosition( Point( p.x, p.y-100) );
|
||||
_emitter->setLife(4);
|
||||
|
||||
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -473,74 +473,74 @@ void DemoModernArt::onEnter()
|
|||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
//FIXME: If use ParticleSystemPoint, bada 1.0 device will crash.
|
||||
//FIXME: If use ParticleSystemPoint, bada 1.0 device will crash.
|
||||
// Crash place: ParticleSystemPoint.cpp Line 149, function: glDrawArrays(GL_POINTS, 0, _particleIdx);
|
||||
_emitter = ParticleSystemQuad::createWithTotalParticles(1000);
|
||||
_emitter->retain();
|
||||
|
||||
_background->addChild(_emitter, 10);
|
||||
////_emitter->release();
|
||||
|
||||
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
|
||||
// duration
|
||||
_emitter->setDuration(-1);
|
||||
|
||||
|
||||
// gravity
|
||||
_emitter->setGravity(Point(0,0));
|
||||
|
||||
|
||||
// angle
|
||||
_emitter->setAngle(0);
|
||||
_emitter->setAngleVar(360);
|
||||
|
||||
|
||||
// radial
|
||||
_emitter->setRadialAccel(70);
|
||||
_emitter->setRadialAccelVar(10);
|
||||
|
||||
|
||||
// tagential
|
||||
_emitter->setTangentialAccel(80);
|
||||
_emitter->setTangentialAccelVar(0);
|
||||
|
||||
|
||||
// speed of particles
|
||||
_emitter->setSpeed(50);
|
||||
_emitter->setSpeedVar(10);
|
||||
|
||||
|
||||
// emitter position
|
||||
_emitter->setPosition( Point( s.width/2, s.height/2) );
|
||||
_emitter->setPosVar(Point::ZERO);
|
||||
|
||||
|
||||
// life of particles
|
||||
_emitter->setLife(2.0f);
|
||||
_emitter->setLifeVar(0.3f);
|
||||
|
||||
|
||||
// emits per frame
|
||||
_emitter->setEmissionRate(_emitter->getTotalParticles()/_emitter->getLife());
|
||||
|
||||
|
||||
// color of particles
|
||||
Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
_emitter->setStartColor(startColor);
|
||||
|
||||
|
||||
Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
_emitter->setStartColorVar(startColorVar);
|
||||
|
||||
|
||||
Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColor(endColor);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColorVar(endColorVar);
|
||||
|
||||
|
||||
// size, in pixels
|
||||
_emitter->setStartSize(1.0f);
|
||||
_emitter->setStartSizeVar(1.0f);
|
||||
_emitter->setEndSize(32.0f);
|
||||
_emitter->setEndSizeVar(8.0f);
|
||||
|
||||
|
||||
// texture
|
||||
_emitter->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
// additive
|
||||
_emitter->setBlendAdditive(false);
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ std::string DemoModernArt::title()
|
|||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// DemoRing
|
||||
// DemoRing
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
void DemoRing::onEnter()
|
||||
|
@ -569,7 +569,7 @@ void DemoRing::onEnter()
|
|||
_emitter->setSpeed(100);
|
||||
_emitter->setSpeedVar(0);
|
||||
_emitter->setEmissionRate(10000);
|
||||
|
||||
|
||||
setEmitterPosition();
|
||||
}
|
||||
|
||||
|
@ -586,16 +586,16 @@ std::string DemoRing::title()
|
|||
void ParallaxParticle::onEnter()
|
||||
{
|
||||
ParticleDemo::onEnter();
|
||||
|
||||
|
||||
_background->getParent()->removeChild(_background, true);
|
||||
_background = NULL;
|
||||
|
||||
auto p = ParallaxNode::create();
|
||||
auto p = ParallaxNode::create();
|
||||
addChild(p, 5);
|
||||
|
||||
auto p1 = Sprite::create(s_back3);
|
||||
auto p2 = Sprite::create(s_back3);
|
||||
|
||||
|
||||
p->addChild( p1, 1, Point(0.5f,1), Point(0,250) );
|
||||
p->addChild(p2, 2, Point(1.5f,1), Point(0,50) );
|
||||
|
||||
|
@ -605,15 +605,15 @@ void ParallaxParticle::onEnter()
|
|||
|
||||
p1->addChild(_emitter, 10);
|
||||
_emitter->setPosition( Point(250,200) );
|
||||
|
||||
|
||||
auto par = ParticleSun::create();
|
||||
p2->addChild(par, 10);
|
||||
par->setTexture( Director::getInstance()->getTextureCache()->addImage(s_fire) );
|
||||
|
||||
|
||||
auto move = MoveBy::create(4, Point(300,0));
|
||||
auto move_back = move->reverse();
|
||||
auto seq = Sequence::create( move, move_back, NULL);
|
||||
p->runAction(RepeatForever::create(seq));
|
||||
p->runAction(RepeatForever::create(seq));
|
||||
}
|
||||
|
||||
std::string ParallaxParticle::title()
|
||||
|
@ -685,7 +685,7 @@ void RadiusMode1::onEnter()
|
|||
Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColor(endColor);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
|
@ -769,7 +769,7 @@ void RadiusMode2::onEnter()
|
|||
Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColor(endColor);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
|
@ -853,7 +853,7 @@ void Issue704::onEnter()
|
|||
Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColor(endColor);
|
||||
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f);
|
||||
_emitter->setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
|
@ -956,7 +956,7 @@ enum
|
|||
IDC_TOGGLE
|
||||
};
|
||||
|
||||
static int sceneIdx = -1;
|
||||
static int sceneIdx = -1;
|
||||
|
||||
#define MAX_LAYER 44
|
||||
|
||||
|
@ -1033,8 +1033,8 @@ Layer* backParticleAction()
|
|||
sceneIdx--;
|
||||
int total = MAX_LAYER;
|
||||
if( sceneIdx < 0 )
|
||||
sceneIdx += total;
|
||||
|
||||
sceneIdx += total;
|
||||
|
||||
auto layer = createParticleLayer(sceneIdx);
|
||||
layer->autorelease();
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ Layer* restartParticleAction()
|
|||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
|
||||
ParticleDemo::~ParticleDemo(void)
|
||||
{
|
||||
|
@ -1060,46 +1060,46 @@ void ParticleDemo::onEnter(void)
|
|||
|
||||
_color = LayerColor::create( Color4B(127,127,127,255) );
|
||||
this->addChild(_color);
|
||||
|
||||
|
||||
_emitter = NULL;
|
||||
|
||||
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
listener->onTouchesBegan = CC_CALLBACK_2(ParticleDemo::onTouchesBegan, this);
|
||||
listener->onTouchesMoved = CC_CALLBACK_2(ParticleDemo::onTouchesMoved, this);
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(ParticleDemo::onTouchesEnded, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
|
||||
auto item4 = MenuItemToggle::createWithCallback( CC_CALLBACK_1(ParticleDemo::toggleCallback, this),
|
||||
MenuItemFont::create( "Free Movement" ),
|
||||
MenuItemFont::create( "Relative Movement" ),
|
||||
MenuItemFont::create( "Grouped Movement" ),
|
||||
NULL );
|
||||
|
||||
|
||||
auto menu = Menu::create(item4, NULL);
|
||||
|
||||
|
||||
menu->setPosition( Point::ZERO );
|
||||
item4->setPosition( Point( VisibleRect::left().x, VisibleRect::bottom().y+ 100) );
|
||||
item4->setAnchorPoint( Point(0,0) );
|
||||
|
||||
|
||||
addChild( menu, 100 );
|
||||
|
||||
|
||||
auto labelAtlas = LabelAtlas::create("0000", "fps_images.png", 12, 32, '.');
|
||||
addChild(labelAtlas, 100, kTagParticleCount);
|
||||
labelAtlas->setPosition(Point(s.width-66,50));
|
||||
|
||||
|
||||
// moving background
|
||||
_background = Sprite::create(s_back3);
|
||||
addChild(_background, 5);
|
||||
_background->setPosition( Point(s.width/2, s.height-180) );
|
||||
|
||||
|
||||
auto move = MoveBy::create(4, Point(300,0) );
|
||||
auto move_back = move->reverse();
|
||||
auto seq = Sequence::create( move, move_back, NULL);
|
||||
_background->runAction( RepeatForever::create(seq) );
|
||||
|
||||
|
||||
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ std::string ParticleDemo::title()
|
|||
|
||||
std::string ParticleDemo::subtitle()
|
||||
{
|
||||
return "No titile";
|
||||
return "No title";
|
||||
}
|
||||
|
||||
void ParticleDemo::onTouchesBegan(const std::vector<Touch*>& touches, Event *event)
|
||||
|
@ -1126,7 +1126,7 @@ void ParticleDemo::onTouchesMoved(const std::vector<Touch*>& touches, Event *ev
|
|||
void ParticleDemo::onTouchesEnded(const std::vector<Touch*>& touches, Event *event)
|
||||
{
|
||||
auto touch = touches[0];
|
||||
|
||||
|
||||
auto location = touch->getLocation();
|
||||
|
||||
auto pos = Point::ZERO;
|
||||
|
@ -1169,7 +1169,7 @@ void ParticleDemo::restartCallback(Object* sender)
|
|||
{
|
||||
if (_emitter != NULL)
|
||||
{
|
||||
_emitter->resetSystem();
|
||||
_emitter->resetSystem();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ void ParticleDemo::backCallback(Object* sender)
|
|||
s->addChild( backParticleAction() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleDemo::setEmitterPosition()
|
||||
{
|
||||
|
@ -1217,10 +1217,10 @@ void ParticleBatchHybrid::onEnter()
|
|||
addChild(batch, 10);
|
||||
|
||||
schedule(schedule_selector(ParticleBatchHybrid::switchRender), 2.0f);
|
||||
|
||||
|
||||
auto node = Node::create();
|
||||
addChild(node);
|
||||
|
||||
|
||||
_parent1 = batch;
|
||||
_parent2 = node;
|
||||
}
|
||||
|
@ -1229,16 +1229,16 @@ void ParticleBatchHybrid::switchRender(float dt)
|
|||
{
|
||||
bool usingBatch = ( _emitter->getBatchNode() != NULL );
|
||||
_emitter->removeFromParentAndCleanup(false);
|
||||
|
||||
|
||||
auto newParent = (usingBatch ? _parent2 : _parent1 );
|
||||
newParent->addChild(_emitter);
|
||||
|
||||
|
||||
log("Particle: Using new parent: %s", usingBatch ? "CCNode" : "CCParticleBatchNode");
|
||||
}
|
||||
|
||||
std::string ParticleBatchHybrid::title()
|
||||
{
|
||||
return "Paticle Batch";
|
||||
return "Particle Batch";
|
||||
}
|
||||
|
||||
std::string ParticleBatchHybrid::subtitle()
|
||||
|
@ -1280,7 +1280,7 @@ void ParticleBatchMultipleEmitters::onEnter()
|
|||
|
||||
std::string ParticleBatchMultipleEmitters::title()
|
||||
{
|
||||
return "Paticle Batch";
|
||||
return "Particle Batch";
|
||||
}
|
||||
|
||||
std::string ParticleBatchMultipleEmitters::subtitle()
|
||||
|
@ -1304,7 +1304,7 @@ void ParticleReorder::onEnter()
|
|||
auto parent2 = ParticleBatchNode::createWithTexture(ignore->getTexture());
|
||||
ignore->unscheduleUpdate();
|
||||
|
||||
for( unsigned int i=0; i<2;i++)
|
||||
for( unsigned int i=0; i<2;i++)
|
||||
{
|
||||
auto parent = ( i==0 ? parent1 : parent2 );
|
||||
|
||||
|
@ -1499,7 +1499,7 @@ void MultipleParticleSystems::onEnter()
|
|||
removeChild(_background, true);
|
||||
_background = NULL;
|
||||
|
||||
Director::getInstance()->getTextureCache()->addImage("Images/particles.png");
|
||||
Director::getInstance()->getTextureCache()->addImage("Images/particles.png");
|
||||
|
||||
for (int i = 0; i<5; i++) {
|
||||
auto particleSystem = ParticleSystemQuad::create("Particles/SpinningPeas.plist");
|
||||
|
@ -1528,15 +1528,15 @@ void MultipleParticleSystems::update(float dt)
|
|||
{
|
||||
auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount);
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(getChildren(), pObj)
|
||||
{
|
||||
auto item = dynamic_cast<ParticleSystem*>(pObj);
|
||||
if (item != NULL)
|
||||
{
|
||||
count += item->getParticleCount();
|
||||
count += item->getParticleCount();
|
||||
}
|
||||
}
|
||||
char str[100] = {0};
|
||||
|
@ -1579,8 +1579,8 @@ void MultipleParticleSystemsBatched::update(float dt)
|
|||
{
|
||||
auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount);
|
||||
|
||||
unsigned count = 0;
|
||||
|
||||
unsigned count = 0;
|
||||
|
||||
auto batchNode = getChildByTag(2);
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(batchNode->getChildren(), pObj)
|
||||
|
@ -1588,7 +1588,7 @@ void MultipleParticleSystemsBatched::update(float dt)
|
|||
auto item = dynamic_cast<ParticleSystem*>(pObj);
|
||||
if (item != NULL)
|
||||
{
|
||||
count += item->getParticleCount();
|
||||
count += item->getParticleCount();
|
||||
}
|
||||
}
|
||||
char str[50] = {0};
|
||||
|
@ -1631,7 +1631,7 @@ void AddAndDeleteParticleSystems::onEnter()
|
|||
|
||||
particleSystem->setPosition(Point(i*15 +100,i*15+100));
|
||||
|
||||
unsigned int randZ = rand() % 100;
|
||||
unsigned int randZ = rand() % 100;
|
||||
_batchNode->addChild(particleSystem, randZ, -1);
|
||||
|
||||
}
|
||||
|
@ -1644,7 +1644,7 @@ void AddAndDeleteParticleSystems::onEnter()
|
|||
void AddAndDeleteParticleSystems::removeSystem(float dt)
|
||||
{
|
||||
int nChildrenCount = _batchNode->getChildren()->count();
|
||||
if (nChildrenCount > 0)
|
||||
if (nChildrenCount > 0)
|
||||
{
|
||||
CCLOG("remove random system");
|
||||
unsigned int uRand = rand() % (nChildrenCount - 1);
|
||||
|
@ -1659,7 +1659,7 @@ void AddAndDeleteParticleSystems::removeSystem(float dt)
|
|||
particleSystem->setPosition(Point(rand() % 300 ,rand() % 400));
|
||||
|
||||
CCLOG("add a new system");
|
||||
unsigned int randZ = rand() % 100;
|
||||
unsigned int randZ = rand() % 100;
|
||||
_batchNode->addChild(particleSystem, randZ, -1);
|
||||
}
|
||||
}
|
||||
|
@ -1668,8 +1668,8 @@ void AddAndDeleteParticleSystems::update(float dt)
|
|||
{
|
||||
auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount);
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
auto batchNode = getChildByTag(2);
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(batchNode->getChildren(), pObj)
|
||||
|
@ -1677,7 +1677,7 @@ void AddAndDeleteParticleSystems::update(float dt)
|
|||
auto item = dynamic_cast<ParticleSystem*>(pObj);
|
||||
if (item != NULL)
|
||||
{
|
||||
count += item->getParticleCount();
|
||||
count += item->getParticleCount();
|
||||
}
|
||||
}
|
||||
char str[100] = {0};
|
||||
|
@ -1796,7 +1796,7 @@ void ReorderParticleSystems::onEnter()
|
|||
void ReorderParticleSystems::reorderSystem(float time)
|
||||
{
|
||||
auto system = (ParticleSystem*)_batchNode->getChildren()->getObjectAtIndex(1);
|
||||
_batchNode->reorderChild(system, system->getZOrder() - 1);
|
||||
_batchNode->reorderChild(system, system->getZOrder() - 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1804,8 +1804,8 @@ void ReorderParticleSystems::update(float dt)
|
|||
{
|
||||
auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount);
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
auto batchNode = getChildByTag(2);
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(batchNode->getChildren(), pObj)
|
||||
|
@ -1813,7 +1813,7 @@ void ReorderParticleSystems::update(float dt)
|
|||
auto item = dynamic_cast<ParticleSystem*>(pObj);
|
||||
if (item != NULL)
|
||||
{
|
||||
count += item->getParticleCount();
|
||||
count += item->getParticleCount();
|
||||
}
|
||||
}
|
||||
char str[100] = {0};
|
||||
|
|
|
@ -3,7 +3,7 @@ local armaturePerformanceTag = 20000
|
|||
local frameEventActionTag = 10000
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local ArmatureTestIndex =
|
||||
local ArmatureTestIndex =
|
||||
{
|
||||
TEST_ASYNCHRONOUS_LOADING = 1,
|
||||
TEST_DIRECT_LOADING = 2,
|
||||
|
@ -52,7 +52,7 @@ function ArmatureTestScene.create()
|
|||
bg:setScaleY(scaleY)
|
||||
|
||||
scene:addChild(bg)
|
||||
return scene
|
||||
return scene
|
||||
end
|
||||
|
||||
function ArmatureTestScene.toMainMenuCallback()
|
||||
|
@ -66,7 +66,7 @@ ArmatureTestLayer._restarItem = nil
|
|||
ArmatureTestLayer._nextItem = nil
|
||||
|
||||
function ArmatureTestLayer:onEnter()
|
||||
|
||||
|
||||
end
|
||||
|
||||
function ArmatureTestLayer.title(idx)
|
||||
|
@ -97,7 +97,7 @@ function ArmatureTestLayer.title(idx)
|
|||
elseif ArmatureTestIndex.TEST_ARMATURE_NESTING == idx then
|
||||
return "Test Armature Nesting"
|
||||
elseif ArmatureTestIndex.TEST_ARMATURE_NESTING_2 == idx then
|
||||
return "Test Armature Nesting 2"
|
||||
return "Test Armature Nesting 2"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -127,7 +127,7 @@ function ArmatureTestLayer.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
@ -152,7 +152,7 @@ end
|
|||
|
||||
function ArmatureTestLayer:createMenu()
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
|
||||
self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
self._backItem:registerScriptTapHandler(self.backCallback)
|
||||
menu:addChild(self._backItem,itemTagBasic)
|
||||
|
@ -160,14 +160,14 @@ function ArmatureTestLayer:createMenu()
|
|||
self._restarItem:registerScriptTapHandler(self.restartCallback)
|
||||
menu:addChild(self._restarItem,itemTagBasic)
|
||||
self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
menu:addChild(self._nextItem,itemTagBasic)
|
||||
menu:addChild(self._nextItem,itemTagBasic)
|
||||
self._nextItem:registerScriptTapHandler(self.nextCallback)
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2))
|
||||
self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
|
||||
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
|
||||
self:addChild(menu)
|
||||
|
@ -181,7 +181,7 @@ function ArmatureTestLayer.toExtensionMenu()
|
|||
end
|
||||
end
|
||||
|
||||
function ArmatureTestLayer:createToExtensionMenu()
|
||||
function ArmatureTestLayer:createToExtensionMenu()
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local menuItemFont = cc.MenuItemFont:create("Back")
|
||||
|
@ -279,7 +279,7 @@ function TestAsynchronousLoading.create()
|
|||
layer:createMenu()
|
||||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
@ -313,7 +313,7 @@ function TestDirectLoading.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
|
@ -348,7 +348,7 @@ function TestCSWithSkeleton.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
@ -366,7 +366,7 @@ function TestDragonBones20.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestDragonBones20:onEnter()
|
||||
function TestDragonBones20:onEnter()
|
||||
local armature = ccs.Armature:create("Dragon")
|
||||
armature:getAnimation():playByIndex(1)
|
||||
armature:getAnimation():setSpeedScale(0.4)
|
||||
|
@ -383,8 +383,8 @@ function TestDragonBones20.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
return layer
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestPerformance = class("TestPerformance",ArmatureTestLayer)
|
||||
|
@ -405,7 +405,7 @@ function TestPerformance.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestPerformance:refreshTitile()
|
||||
function TestPerformance:refreshTitle()
|
||||
local subTitleInfo = ArmatureTestLayer.subTitle(5) .. self._armatureCount
|
||||
local label = tolua.cast(self:getChildByTag(10001),"LabelTTF")
|
||||
label:setString(subTitleInfo)
|
||||
|
@ -429,7 +429,7 @@ function TestPerformance:addArmature(num)
|
|||
self:addArmatureToParent(armature)
|
||||
end
|
||||
|
||||
self:refreshTitile()
|
||||
self:refreshTitle()
|
||||
end
|
||||
|
||||
function TestPerformance:onEnter()
|
||||
|
@ -446,7 +446,7 @@ function TestPerformance:onEnter()
|
|||
for i = 1, 20 do
|
||||
self:removeArmatureFromParent(armaturePerformanceTag + self._armatureCount)
|
||||
self._armatureCount = self._armatureCount - 1
|
||||
self:refreshTitile()
|
||||
self:refreshTitle()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -458,7 +458,7 @@ function TestPerformance:onEnter()
|
|||
local increase = cc.MenuItemFont:create(" + ")
|
||||
increase:setColor(cc.c3b(0,200,20))
|
||||
increase:registerScriptTapHandler(onIncrease)
|
||||
|
||||
|
||||
local menu = cc.Menu:create(decrease, increase )
|
||||
menu:alignItemsHorizontally()
|
||||
menu:setPosition(cc.p(VisibleRect:getVisibleRect().width/2, VisibleRect:getVisibleRect().height-100))
|
||||
|
@ -481,8 +481,8 @@ function TestPerformance.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
layer:onEnter()
|
||||
end
|
||||
return layer
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestPerformanceBatchNode = class("TestPerformanceBatchNode",TestPerformance)
|
||||
|
@ -507,7 +507,7 @@ function TestPerformanceBatchNode:removeArmatureFromParent(tag)
|
|||
self._batchNode:removeChildByTag(armaturePerformanceTag + self._armatureCount, true)
|
||||
end
|
||||
|
||||
function TestPerformanceBatchNode:onEnter()
|
||||
function TestPerformanceBatchNode:onEnter()
|
||||
self._batchNode = ccs.BatchNode:create()
|
||||
self:addChild(self._batchNode)
|
||||
|
||||
|
@ -523,7 +523,7 @@ function TestPerformanceBatchNode:onEnter()
|
|||
for i = 1, 20 do
|
||||
self:removeArmatureFromParent(armaturePerformanceTag + self._armatureCount)
|
||||
self._armatureCount = self._armatureCount - 1
|
||||
self:refreshTitile()
|
||||
self:refreshTitle()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -535,7 +535,7 @@ function TestPerformanceBatchNode:onEnter()
|
|||
local increase = cc.MenuItemFont:create(" + ")
|
||||
increase:setColor(cc.c3b(0,200,20))
|
||||
increase:registerScriptTapHandler(onIncrease)
|
||||
|
||||
|
||||
local menu = cc.Menu:create(decrease, increase )
|
||||
menu:alignItemsHorizontally()
|
||||
menu:setPosition(cc.p(VisibleRect:getVisibleRect().width/2, VisibleRect:getVisibleRect().height-100))
|
||||
|
@ -558,8 +558,8 @@ function TestPerformanceBatchNode.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
layer:onEnter()
|
||||
end
|
||||
return layer
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestChangeZorder = class("TestChangeZorder",ArmatureTestLayer)
|
||||
|
@ -576,7 +576,7 @@ function TestChangeZorder.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestChangeZorder:onEnter()
|
||||
function TestChangeZorder:onEnter()
|
||||
self.currentTag = -1
|
||||
|
||||
local armature = ccs.Armature:create("Knight_f/Knight")
|
||||
|
@ -617,8 +617,8 @@ function TestChangeZorder.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
return layer
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
--UNDO callback
|
||||
|
@ -635,7 +635,7 @@ function TestAnimationEvent.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestAnimationEvent:onEnter()
|
||||
function TestAnimationEvent:onEnter()
|
||||
local armature = ccs.Armature:create("Cowboy")
|
||||
armature:getAnimation():play("Fire")
|
||||
armature:setScaleX(-0.24)
|
||||
|
@ -682,8 +682,8 @@ function TestAnimationEvent.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
return layer
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestFrameEvent = class("TestFrameEvent",ArmatureTestLayer)
|
||||
|
@ -699,7 +699,7 @@ function TestFrameEvent.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestFrameEvent:onEnter()
|
||||
function TestFrameEvent:onEnter()
|
||||
local armature = ccs.Armature:create("HeroAnimation")
|
||||
armature:getAnimation():play("attack")
|
||||
armature:getAnimation():setSpeedScale(0.5)
|
||||
|
@ -708,7 +708,7 @@ function TestFrameEvent:onEnter()
|
|||
local function onFrameEvent( bone,evt,originFrameIndex,currentFrameIndex)
|
||||
if (not self:getActionByTag(frameEventActionTag)) or (not self:getActionByTag(frameEventActionTag):isDone()) then
|
||||
self:stopAllActions()
|
||||
local action = cc.ShatteredTiles3D:create(0.2, cc.size(16,12), 5, false)
|
||||
local action = cc.ShatteredTiles3D:create(0.2, cc.size(16,12), 5, false)
|
||||
action:setTag(frameEventActionTag)
|
||||
self:runAction(action)
|
||||
end
|
||||
|
@ -741,8 +741,8 @@ function TestFrameEvent.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
layer:onEnter()
|
||||
end
|
||||
return layer
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestParticleDisplay = class("TestParticleDisplay",ArmatureTestLayer)
|
||||
|
@ -760,8 +760,8 @@ function TestParticleDisplay.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestParticleDisplay:onEnter()
|
||||
self:setTouchEnabled(true)
|
||||
function TestParticleDisplay:onEnter()
|
||||
self:setTouchEnabled(true)
|
||||
self.animationID = 0
|
||||
|
||||
self.armature = ccs.Armature:create("robot")
|
||||
|
@ -780,7 +780,7 @@ function TestParticleDisplay:onEnter()
|
|||
bone:setZOrder(100)
|
||||
bone:setScale(1.2)
|
||||
self.armature:addBone(bone, "bady-a3")
|
||||
|
||||
|
||||
bone = ccs.Bone:create("p2")
|
||||
bone:addDisplay(p2, 0)
|
||||
bone:changeDisplayByIndex(0, true)
|
||||
|
@ -812,9 +812,9 @@ function TestParticleDisplay.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestUseMutiplePicture = class("TestUseMutiplePicture",ArmatureTestLayer)
|
||||
|
@ -832,8 +832,8 @@ function TestUseMutiplePicture.extend(target)
|
|||
return target
|
||||
end
|
||||
|
||||
function TestUseMutiplePicture:onEnter()
|
||||
self:setTouchEnabled(true)
|
||||
function TestUseMutiplePicture:onEnter()
|
||||
self:setTouchEnabled(true)
|
||||
self.displayIndex = 1
|
||||
|
||||
self.armature = ccs.Armature:create("Knight_f/Knight")
|
||||
|
@ -842,14 +842,14 @@ function TestUseMutiplePicture:onEnter()
|
|||
self.armature:setScale(1.2)
|
||||
self:addChild(self.armature)
|
||||
|
||||
local weapon =
|
||||
local weapon =
|
||||
{
|
||||
"weapon_f-sword.png",
|
||||
"weapon_f-sword2.png",
|
||||
"weapon_f-sword3.png",
|
||||
"weapon_f-sword4.png",
|
||||
"weapon_f-sword5.png",
|
||||
"weapon_f-knife.png",
|
||||
"weapon_f-sword.png",
|
||||
"weapon_f-sword2.png",
|
||||
"weapon_f-sword3.png",
|
||||
"weapon_f-sword4.png",
|
||||
"weapon_f-sword5.png",
|
||||
"weapon_f-knife.png",
|
||||
"weapon_f-hammer.png",
|
||||
}
|
||||
|
||||
|
@ -882,9 +882,9 @@ function TestUseMutiplePicture.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
return layer
|
||||
end
|
||||
|
||||
local TestAnchorPoint = class("TestAnchorPoint",ArmatureTestLayer)
|
||||
|
@ -925,7 +925,7 @@ function TestAnchorPoint.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
@ -946,7 +946,7 @@ function TestArmatureNesting.extend(target)
|
|||
end
|
||||
|
||||
function TestArmatureNesting:onEnter()
|
||||
self:setTouchEnabled(true)
|
||||
self:setTouchEnabled(true)
|
||||
self.weaponIndex = 0
|
||||
|
||||
self.armature = ccs.Armature:create("cyborg")
|
||||
|
@ -980,9 +980,9 @@ function TestArmatureNesting.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:onEnter()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
return layer
|
||||
end
|
||||
|
||||
local Hero = class("Hero")
|
||||
|
@ -1140,9 +1140,9 @@ function TestArmatureNesting2.create()
|
|||
layer:createToExtensionMenu()
|
||||
layer:creatTitleAndSubTitle(armatureSceneIdx)
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
|
||||
return layer
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ function nextArmatureTest()
|
|||
return armatureSceneArr[armatureSceneIdx]()
|
||||
end
|
||||
|
||||
function backArmatureTest()
|
||||
function backArmatureTest()
|
||||
armatureSceneIdx = armatureSceneIdx - 1
|
||||
if armatureSceneIdx <= 0 then
|
||||
armatureSceneIdx = armatureSceneIdx + table.getn(armatureSceneArr)
|
||||
|
@ -1187,7 +1187,7 @@ function restartArmatureTest()
|
|||
end
|
||||
|
||||
local function addFileInfo()
|
||||
|
||||
|
||||
end
|
||||
|
||||
function runArmatureTestScene()
|
||||
|
|
|
@ -330,7 +330,7 @@ local function ParticleBatchHybrid()
|
|||
|
||||
layer:registerScriptHandler(ParticleBatchHybrid_onEnterOrExit)
|
||||
|
||||
titleLabel:setString("Paticle Batch")
|
||||
titleLabel:setString("Particle Batch")
|
||||
subtitleLabel:setString("Hybrid: batched and non batched every 2 seconds")
|
||||
return layer
|
||||
end
|
||||
|
@ -364,7 +364,7 @@ local function ParticleBatchMultipleEmitters()
|
|||
|
||||
layer:addChild(batch, 10)
|
||||
|
||||
titleLabel:setString("Paticle Batch")
|
||||
titleLabel:setString("Particle Batch")
|
||||
subtitleLabel:setString("Multiple emitters. One Batch")
|
||||
return layer
|
||||
end
|
||||
|
@ -900,7 +900,7 @@ local function RadiusMode1()
|
|||
emitter:setTexture(cc.TextureCache:getInstance():addImage("Images/stars-grayscale.png"))
|
||||
|
||||
-- duration
|
||||
emitter:setDuration(cc.PARTICLE_DURATION_INFINITY)
|
||||
emitter:setDuration(cc.PARTICLE_DURATION_INFINITY)
|
||||
|
||||
-- radius mode
|
||||
emitter:setEmitterMode(cc.PARTICLE_MODE_RADIUS)
|
||||
|
|
Loading…
Reference in New Issue