2012-04-08 14:16:29 +08:00
|
|
|
#include "EffectsAdvancedTest.h"
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
enum
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
kTagTextLayer = 1,
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
kTagSprite1 = 1,
|
|
|
|
kTagSprite2 = 2,
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
kTagBackground = 1,
|
|
|
|
kTagLabel = 2,
|
2012-04-08 14:16:29 +08:00
|
|
|
};
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Effect1
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-08 14:16:29 +08:00
|
|
|
void Effect1::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onEnter();
|
|
|
|
|
|
|
|
CCNode* target = getChildByTag(kTagBackground);
|
|
|
|
|
|
|
|
// To reuse a grid the grid size and the grid type must be the same.
|
|
|
|
// in this case:
|
|
|
|
// Lens3D is Grid3D and it's size is (15,10)
|
|
|
|
// Waves3D is Grid3D and it's size is (15,10)
|
|
|
|
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* lens = CCLens3D::create(ccp(size.width/2,size.height/2), 240, ccg(15,10), 0.0f);
|
|
|
|
CCActionInterval* waves = CCWaves3D::create(18, 15, ccg(15,10), 10);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCFiniteTimeAction* reuse = CCReuseGrid::create(1);
|
|
|
|
CCActionInterval* delay = CCDelayTime::create(8);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* orbit = CCOrbitCamera::create(5, 1, 2, 0, 180, 0, -90);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* orbit_back = orbit->reverse();
|
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
target->runAction( CCRepeatForever::create( CCSequence::create( orbit, orbit_back, NULL) ) );
|
2012-06-14 15:13:16 +08:00
|
|
|
target->runAction( CCSequence::create(lens, delay, reuse, waves, NULL) );
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
std::string Effect1::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Lens + Waves3d and OrbitCamera";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Effect2
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-08 14:16:29 +08:00
|
|
|
void Effect2::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onEnter();
|
|
|
|
|
|
|
|
CCNode* target = getChildByTag(kTagBackground);
|
|
|
|
|
|
|
|
// To reuse a grid the grid size and the grid type must be the same.
|
|
|
|
// in this case:
|
|
|
|
// ShakyTiles is TiledGrid3D and it's size is (15,10)
|
|
|
|
// Shuffletiles is TiledGrid3D and it's size is (15,10)
|
|
|
|
// TurnOfftiles is TiledGrid3D and it's size is (15,10)
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* shaky = CCShakyTiles3D::create(4, false, ccg(15,10), 5);
|
|
|
|
CCActionInterval* shuffle = CCShuffleTiles::create(0, ccg(15,10), 3);
|
|
|
|
CCActionInterval* turnoff = CCTurnOffTiles::create(0, ccg(15,10), 3);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* turnon = turnoff->reverse();
|
|
|
|
|
|
|
|
// reuse 2 times:
|
|
|
|
// 1 for shuffle
|
|
|
|
// 2 for turn off
|
|
|
|
// turnon tiles will use a new grid
|
2012-06-14 15:13:16 +08:00
|
|
|
CCFiniteTimeAction* reuse = CCReuseGrid::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* delay = CCDelayTime::create(1);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
// id orbit = [OrbitCamera::create:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
|
2012-04-19 14:35:52 +08:00
|
|
|
// id orbit_back = [orbit reverse];
|
2010-09-16 11:35:58 +08:00
|
|
|
//
|
2012-06-14 15:13:16 +08:00
|
|
|
// [target runAction: [RepeatForever::create: [Sequence actions: orbit, orbit_back, nil]]];
|
2012-12-10 14:12:56 +08:00
|
|
|
target->runAction(CCSequence::create( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) );
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
std::string Effect2::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "ShakyTiles + ShuffleTiles + TurnOffTiles";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Effect3
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-08 14:16:29 +08:00
|
|
|
void Effect3::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onEnter();
|
|
|
|
|
|
|
|
CCNode* bg = getChildByTag(kTagBackground);
|
|
|
|
CCNode* target1 = bg->getChildByTag(kTagSprite1);
|
|
|
|
CCNode* target2 = bg->getChildByTag(kTagSprite2);
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* waves = CCWaves::create(5, 20, true, false, ccg(15,10), 5);
|
|
|
|
CCActionInterval* shaky = CCShaky3D::create(4, false, ccg(15,10), 5);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
target1->runAction( CCRepeatForever::create( waves ) );
|
|
|
|
target2->runAction( CCRepeatForever::create( shaky ) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// moving background. Testing issue #244
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* move = CCMoveBy::create(3, ccp(200,0) );
|
2012-12-10 14:12:56 +08:00
|
|
|
bg->runAction(CCRepeatForever::create( CCSequence::create(move, move->reverse(), NULL) ));
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
std::string Effect3::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Effects on 2 sprites";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Effect4
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-06-27 18:44:25 +08:00
|
|
|
|
|
|
|
class Lens3DTarget : public CCNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void setPosition(const CCPoint& var)
|
|
|
|
{
|
|
|
|
m_pLens3D->setPosition(var);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Lens3DTarget* create(CCLens3D* pAction)
|
|
|
|
{
|
|
|
|
Lens3DTarget* pRet = new Lens3DTarget();
|
|
|
|
pRet->m_pLens3D = pAction;
|
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
private:
|
2012-06-27 20:50:47 +08:00
|
|
|
|
|
|
|
Lens3DTarget()
|
|
|
|
: m_pLens3D(NULL)
|
|
|
|
{}
|
|
|
|
|
2012-06-27 18:44:25 +08:00
|
|
|
CCLens3D* m_pLens3D;
|
|
|
|
};
|
|
|
|
|
2012-04-08 14:16:29 +08:00
|
|
|
void Effect4::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onEnter();
|
2012-04-08 14:16:29 +08:00
|
|
|
|
2012-06-27 18:44:25 +08:00
|
|
|
CCLens3D* lens = CCLens3D::create(ccp(100,180), 150, ccg(32,24), 10);
|
|
|
|
CCActionInterval* move = CCJumpBy::create(5, ccp(380,0), 100, 4);
|
|
|
|
CCActionInterval* move_back = move->reverse();
|
2012-12-10 14:12:56 +08:00
|
|
|
CCActionInterval* seq = CCSequence::create( move, move_back, NULL);
|
2012-04-08 14:16:29 +08:00
|
|
|
|
2012-06-27 20:50:47 +08:00
|
|
|
/* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'CCLens3D' as its target.
|
|
|
|
While in cocos2d-x, the target of action only supports CCNode or its subclass,
|
|
|
|
so we make an encapsulation for CCLens3D to achieve that.
|
|
|
|
*/
|
|
|
|
|
2012-06-27 18:44:25 +08:00
|
|
|
CCDirector* director = CCDirector::sharedDirector();
|
|
|
|
CCNode* pTarget = Lens3DTarget::create(lens);
|
2012-06-27 20:50:47 +08:00
|
|
|
// Please make sure the target been added to its parent.
|
|
|
|
this->addChild(pTarget);
|
|
|
|
|
2012-06-27 18:44:25 +08:00
|
|
|
director->getActionManager()->addAction(seq, pTarget, false);
|
|
|
|
this->runAction( lens );
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
std::string Effect4::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Jumpy Lens3D";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Effect5
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-08 14:16:29 +08:00
|
|
|
void Effect5::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onEnter();
|
|
|
|
|
|
|
|
//CCDirector::sharedDirector()->setProjection(CCDirectorProjection2D);
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* effect = CCLiquid::create(1, 20, ccg(32,24), 2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
CCActionInterval* stopEffect = CCSequence::create(
|
2012-04-19 14:35:52 +08:00
|
|
|
effect,
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime::create(2),
|
|
|
|
CCStopGrid::create(),
|
|
|
|
// [DelayTime::create:2],
|
2012-04-19 14:35:52 +08:00
|
|
|
// [[effect copy] autorelease],
|
2012-12-10 14:12:56 +08:00
|
|
|
NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
CCNode* bg = getChildByTag(kTagBackground);
|
|
|
|
bg->runAction(stopEffect);
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
std::string Effect5::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Test Stop-Copy-Restar";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
void Effect5::onExit()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onExit();
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
CCDirector::sharedDirector()->setProjection(kCCDirectorProjection3D);
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Effect5
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-08 14:16:29 +08:00
|
|
|
void Issue631::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
EffectAdvanceTextLayer::onEnter();
|
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
CCActionInterval* effect = CCSequence::create( CCDelayTime::create(2.0f), CCShaky3D::create(16, false, ccg(5, 5), 5.0f), NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// cleanup
|
|
|
|
CCNode* bg = getChildByTag(kTagBackground);
|
|
|
|
removeChild(bg, true);
|
|
|
|
|
|
|
|
// background
|
2012-06-14 15:13:16 +08:00
|
|
|
CCLayerColor* layer = CCLayerColor::create( ccc4(255,0,0,255) );
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(layer, -10);
|
2012-06-14 15:13:16 +08:00
|
|
|
CCSprite* sprite = CCSprite::create("Images/grossini.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->setPosition( ccp(50,80) );
|
|
|
|
layer->addChild(sprite, 10);
|
|
|
|
|
|
|
|
// foreground
|
2012-06-14 15:13:16 +08:00
|
|
|
CCLayerColor* layer2 = CCLayerColor::create(ccc4( 0, 255,0,255 ) );
|
|
|
|
CCSprite* fog = CCSprite::create("Images/Fog.png");
|
2012-04-08 14:16:29 +08:00
|
|
|
|
|
|
|
ccBlendFunc bf = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
|
2012-04-19 14:35:52 +08:00
|
|
|
fog->setBlendFunc(bf);
|
|
|
|
layer2->addChild(fog, 1);
|
|
|
|
addChild(layer2, 1);
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
layer2->runAction( CCRepeatForever::create(effect) );
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string Issue631::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Testing Opacity";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string Issue631::subtitle()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Effect image should be 100% opaque. Testing issue #631";
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// EffectAdvanceTextLayer
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-08 14:16:29 +08:00
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
enum
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
IDC_NEXT = 100,
|
|
|
|
IDC_BACK,
|
|
|
|
IDC_RESTART
|
2010-09-16 11:35:58 +08:00
|
|
|
};
|
2012-04-08 14:16:29 +08:00
|
|
|
|
|
|
|
static int sceneIdx = -1;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
#define MAX_LAYER 6
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2011-07-08 15:57:46 +08:00
|
|
|
CCLayer* nextEffectAdvanceAction();
|
|
|
|
CCLayer* backEffectAdvanceAction();
|
|
|
|
CCLayer* restartEffectAdvanceAction();
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
CCLayer* createEffectAdvanceLayer(int nIndex)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
switch(nIndex)
|
|
|
|
{
|
|
|
|
case 0: return new Effect3();
|
|
|
|
case 1: return new Effect2();
|
|
|
|
case 2: return new Effect1();
|
|
|
|
case 3: return new Effect4();
|
|
|
|
case 4: return new Effect5();
|
|
|
|
case 5: return new Issue631();
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2010-09-16 11:35:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCLayer* nextEffectAdvanceAction()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
sceneIdx++;
|
|
|
|
sceneIdx = sceneIdx % MAX_LAYER;
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
CCLayer* pLayer = createEffectAdvanceLayer(sceneIdx);
|
|
|
|
pLayer->autorelease();
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
return pLayer;
|
2010-09-16 11:35:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCLayer* backEffectAdvanceAction()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
sceneIdx--;
|
|
|
|
int total = MAX_LAYER;
|
|
|
|
if( sceneIdx < 0 )
|
|
|
|
sceneIdx += total;
|
|
|
|
|
|
|
|
CCLayer* pLayer = createEffectAdvanceLayer(sceneIdx);
|
|
|
|
pLayer->autorelease();
|
|
|
|
|
|
|
|
return pLayer;
|
2010-09-16 11:35:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CCLayer* restartEffectAdvanceAction()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCLayer* pLayer = createEffectAdvanceLayer(sceneIdx);
|
|
|
|
pLayer->autorelease();
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
return pLayer;
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EffectAdvanceTextLayer::onEnter(void)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCLayer::onEnter();
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCSprite *bg = CCSprite::create("Images/background3.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(bg, 0, kTagBackground);
|
2012-10-23 17:48:50 +08:00
|
|
|
bg->setPosition( VisibleRect::center() );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCSprite* grossini = CCSprite::create("Images/grossinis_sister2.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
bg->addChild(grossini, 1, kTagSprite1);
|
2012-10-23 17:48:50 +08:00
|
|
|
grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200) );
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* sc = CCScaleBy::create(2, 5);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* sc_back = sc->reverse();
|
2012-12-10 14:12:56 +08:00
|
|
|
grossini->runAction( CCRepeatForever::create(CCSequence::create(sc, sc_back, NULL) ) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCSprite* tamara = CCSprite::create("Images/grossinis_sister1.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
bg->addChild(tamara, 1, kTagSprite2);
|
2012-10-23 17:48:50 +08:00
|
|
|
tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) );
|
2012-06-14 15:13:16 +08:00
|
|
|
CCActionInterval* sc2 = CCScaleBy::create(2, 5);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* sc2_back = sc2->reverse();
|
2012-12-10 14:12:56 +08:00
|
|
|
tamara->runAction( CCRepeatForever::create(CCSequence::create(sc2, sc2_back, NULL) ) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Marker Felt", 28);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-10-23 17:48:50 +08:00
|
|
|
label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(label);
|
|
|
|
label->setTag( kTagLabel );
|
|
|
|
|
|
|
|
std::string strSubtitle = subtitle();
|
|
|
|
if( ! strSubtitle.empty() )
|
|
|
|
{
|
2012-06-14 15:13:16 +08:00
|
|
|
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(l, 101);
|
2012-10-23 17:48:50 +08:00
|
|
|
l->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) );
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
|
|
|
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", this, menu_selector(EffectAdvanceTextLayer::restartCallback) );
|
|
|
|
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", this, menu_selector(EffectAdvanceTextLayer::nextCallback) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-12 16:56:34 +08:00
|
|
|
menu->setPosition(CCPointZero);
|
2012-10-23 17:48:50 +08:00
|
|
|
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
|
|
|
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
|
|
|
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
addChild(menu, 1);
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
EffectAdvanceTextLayer::~EffectAdvanceTextLayer(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-09-16 11:35:58 +08:00
|
|
|
std::string EffectAdvanceTextLayer::title()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "No title";
|
2010-09-16 11:35:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string EffectAdvanceTextLayer::subtitle()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "";
|
2010-09-16 11:35:58 +08:00
|
|
|
}
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
void EffectAdvanceTextLayer::restartCallback(CCObject* pSender)
|
2010-09-16 11:35:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScene* s = new EffectAdvanceScene();
|
|
|
|
s->addChild(restartEffectAdvanceAction());
|
2010-09-16 11:35:58 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
CCDirector::sharedDirector()->replaceScene(s);
|
2010-09-16 11:35:58 +08:00
|
|
|
s->release();
|
|
|
|
}
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
void EffectAdvanceTextLayer::nextCallback(CCObject* pSender)
|
2010-09-16 11:35:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScene* s = new EffectAdvanceScene();
|
|
|
|
s->addChild( nextEffectAdvanceAction() );
|
|
|
|
CCDirector::sharedDirector()->replaceScene(s);
|
2010-09-16 11:35:58 +08:00
|
|
|
|
|
|
|
s->release();
|
|
|
|
}
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
void EffectAdvanceTextLayer::backCallback(CCObject* pSender)
|
2010-09-16 11:35:58 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScene* s = new EffectAdvanceScene();
|
|
|
|
s->addChild( backEffectAdvanceAction() );
|
|
|
|
CCDirector::sharedDirector()->replaceScene(s);
|
2010-09-16 11:35:58 +08:00
|
|
|
s->release();
|
2012-04-08 14:16:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectAdvanceScene::runThisTest()
|
|
|
|
{
|
|
|
|
CCLayer* pLayer = nextEffectAdvanceAction();
|
|
|
|
|
|
|
|
addChild(pLayer);
|
|
|
|
CCDirector::sharedDirector()->replaceScene(this);
|
|
|
|
}
|