2011-05-26 21:01:16 +08:00
|
|
|
#include "EffectsTest.h"
|
|
|
|
#include "../testResource.h"
|
2010-08-23 10:17:29 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
kTagTextLayer = 1,
|
|
|
|
|
|
|
|
kTagBackground = 1,
|
|
|
|
kTagLabel = 2,
|
|
|
|
};
|
2011-05-26 21:01:16 +08:00
|
|
|
|
|
|
|
static int actionIdx=0;
|
2010-08-23 10:17:29 +08:00
|
|
|
static std::string effectsList[] =
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
"Shaky3D",
|
|
|
|
"Waves3D",
|
|
|
|
"FlipX3D",
|
|
|
|
"FlipY3D",
|
|
|
|
"Lens3D",
|
|
|
|
"Ripple3D",
|
|
|
|
"Liquid",
|
|
|
|
"Waves",
|
|
|
|
"Twirl",
|
|
|
|
"ShakyTiles3D",
|
|
|
|
"ShatteredTiles3D",
|
|
|
|
"ShuffleTiles",
|
|
|
|
"FadeOutTRTiles",
|
|
|
|
"FadeOutBLTiles",
|
|
|
|
"FadeOutUpTiles",
|
|
|
|
"FadeOutDownTiles",
|
|
|
|
"TurnOffTiles",
|
|
|
|
"WavesTiles3D",
|
|
|
|
"JumpTiles3D",
|
|
|
|
"SplitRows",
|
|
|
|
"SplitCols",
|
|
|
|
"PageTurn3D",
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class Shaky3DDemo : public CCShaky3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCShaky3D::create(t, CCSizeMake(15,10), 5, false);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class Waves3DDemo : public CCWaves3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCWaves3D::create(t, CCSizeMake(15,10), 5, 40);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class FlipX3DDemo : public CCFlipX3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-14 15:13:16 +08:00
|
|
|
CCFlipX3D* flipx = CCFlipX3D::create(t);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* flipx_back = flipx->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(flipx, delay, flipx_back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class FlipY3DDemo : public CCFlipY3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-14 15:13:16 +08:00
|
|
|
CCFlipY3D* flipy = CCFlipY3D::create(t);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* flipy_back = flipy->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(flipy, delay, flipy_back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class Lens3DDemo : public CCLens3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCLens3D::create(t, CCSizeMake(15,10), ccp(size.width/2,size.height/2), 240);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class Ripple3DDemo : public CCRipple3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCRipple3D::create(t, CCSizeMake(32,24), ccp(size.width/2,size.height/2), 240, 4, 160);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class LiquidDemo : public CCLiquid
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCLiquid::create(t, CCSizeMake(16,12), 4, 20);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class WavesDemo : public CCWaves
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCWaves::create(t, CCSizeMake(16,12), 4, 20, true, true);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class TwirlDemo : public CCTwirl
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCTwirl::create(t, CCSizeMake(12,8), ccp(size.width/2, size.height/2), 1, 2.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class ShakyTiles3DDemo : public CCShakyTiles3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCShakyTiles3D::create(t, CCSizeMake(16,12), 5, false) ;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class ShatteredTiles3DDemo : public CCShatteredTiles3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCShatteredTiles3D::create(t, CCSizeMake(16,12), 5, false);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class ShuffleTilesDemo : public CCShuffleTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
CCShuffleTiles* shuffle = CCShuffleTiles::create(t, CCSizeMake(16,12), 25);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* shuffle_back = shuffle->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(shuffle, delay, shuffle_back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class FadeOutTRTilesDemo : public CCFadeOutTRTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
CCFadeOutTRTiles* fadeout = CCFadeOutTRTiles::create(t, CCSizeMake(16,12));
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* back = fadeout->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class FadeOutBLTilesDemo : public CCFadeOutBLTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
CCFadeOutBLTiles* fadeout = CCFadeOutBLTiles::create(t, CCSizeMake(16,12));
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* back = fadeout->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class FadeOutUpTilesDemo : public CCFadeOutUpTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
CCFadeOutUpTiles* fadeout = CCFadeOutUpTiles::create(t, CCSizeMake(16,12));
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* back = fadeout->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class FadeOutDownTilesDemo : public CCFadeOutDownTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
CCFadeOutDownTiles* fadeout = CCFadeOutDownTiles::create(t, CCSizeMake(16,12));
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* back = fadeout->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class TurnOffTilesDemo : public CCTurnOffTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 11:48:46 +08:00
|
|
|
CCTurnOffTiles* fadeout = CCTurnOffTiles::create(t, CCSizeMake(48,32), 25);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* back = fadeout->reverse();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCDelayTime* delay = CCDelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-10 14:12:56 +08:00
|
|
|
return CCSequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
2010-08-23 10:17:29 +08:00
|
|
|
|
|
|
|
class WavesTiles3DDemo : public CCWavesTiles3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCWavesTiles3D::create(t, CCSizeMake(15,10), 4, 120);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
2010-08-23 10:17:29 +08:00
|
|
|
|
|
|
|
class JumpTiles3DDemo : public CCJumpTiles3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCJumpTiles3D::create(t, CCSizeMake(15,10), 2, 30);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
2010-08-23 10:17:29 +08:00
|
|
|
|
|
|
|
class SplitRowsDemo : public CCSplitRows
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCSplitRows::create(t, 9);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class SplitColsDemo : public CCSplitCols
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCSplitCols::create(t, 9);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
class PageTurn3DDemo : public CCPageTurn3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2011-06-03 10:51:21 +08:00
|
|
|
CCDirector::sharedDirector()->setDepthTest(true);
|
2012-12-27 10:55:25 +08:00
|
|
|
return CCPageTurn3D::create(t, CCSizeMake(15,10));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2010-08-23 10:17:29 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextLayer
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
#define MAX_LAYER 22
|
2010-08-23 10:17:29 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
CCActionInterval* createEffect(int nIndex, float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
|
2011-06-27 15:34:26 +08:00
|
|
|
CCDirector::sharedDirector()->setDepthTest(false);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
switch(nIndex)
|
|
|
|
{
|
2012-06-14 15:13:16 +08:00
|
|
|
case 0: return Shaky3DDemo::create(t);
|
|
|
|
case 1: return Waves3DDemo::create(t);
|
|
|
|
case 2: return FlipX3DDemo::create(t);
|
|
|
|
case 3: return FlipY3DDemo::create(t);
|
|
|
|
case 4: return Lens3DDemo::create(t);
|
|
|
|
case 5: return Ripple3DDemo::create(t);
|
|
|
|
case 6: return LiquidDemo::create(t);
|
|
|
|
case 7: return WavesDemo::create(t);
|
|
|
|
case 8: return TwirlDemo::create(t);
|
|
|
|
case 9: return ShakyTiles3DDemo::create(t);
|
|
|
|
case 10: return ShatteredTiles3DDemo::create(t);
|
|
|
|
case 11: return ShuffleTilesDemo::create(t);
|
|
|
|
case 12: return FadeOutTRTilesDemo::create(t);
|
|
|
|
case 13: return FadeOutBLTilesDemo::create(t);
|
|
|
|
case 14: return FadeOutUpTilesDemo::create(t);
|
|
|
|
case 15: return FadeOutDownTilesDemo::create(t);
|
|
|
|
case 16: return TurnOffTilesDemo::create(t);
|
|
|
|
case 17: return WavesTiles3DDemo::create(t);
|
|
|
|
case 18: return JumpTiles3DDemo::create(t);
|
|
|
|
case 19: return SplitRowsDemo::create(t);
|
|
|
|
case 20: return SplitColsDemo::create(t);
|
|
|
|
case 21: return PageTurn3DDemo::create(t);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
2010-12-22 15:43:54 +08:00
|
|
|
CCActionInterval* getAction()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* pEffect = createEffect(actionIdx, 3);
|
2010-08-23 10:17:29 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
return pEffect;
|
2011-05-26 21:01:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectTestScene::runThisTest()
|
|
|
|
{
|
2012-06-14 15:13:16 +08:00
|
|
|
addChild(TextLayer::create());
|
2011-05-26 21:01:16 +08:00
|
|
|
CCDirector::sharedDirector()->replaceScene(this);
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
#define SID_RESTART 1
|
2011-05-26 21:01:16 +08:00
|
|
|
|
|
|
|
TextLayer::TextLayer(void)
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
initWithColor( ccc4(32,128,32,255) );
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCNode* node = CCNode::create();
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInterval* effect = getAction();
|
2012-06-12 16:56:34 +08:00
|
|
|
node->runAction(effect);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(node, 0, kTagBackground);
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCSprite *bg = CCSprite::create(s_back3);
|
2012-04-19 14:35:52 +08:00
|
|
|
node->addChild(bg, 0);
|
2012-06-12 16:56:34 +08:00
|
|
|
// bg->setAnchorPoint( CCPointZero );
|
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(s_pPathSister2);
|
2012-04-19 14:35:52 +08:00
|
|
|
node->addChild(grossini, 1);
|
2012-10-23 17:48:50 +08:00
|
|
|
grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
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(s_pPathSister1);
|
2012-04-19 14:35:52 +08:00
|
|
|
node->addChild(tamara, 1);
|
2012-10-23 17:48:50 +08:00
|
|
|
tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
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((effectsList[actionIdx]).c_str(), "Marker Felt", 32);
|
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 );
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TextLayer::backCallback) );
|
|
|
|
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(TextLayer::restartCallback) );
|
|
|
|
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TextLayer::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);
|
|
|
|
|
|
|
|
schedule( schedule_selector(TextLayer::checkAnim) );
|
2011-05-26 21:01:16 +08:00
|
|
|
}
|
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void TextLayer::checkAnim(float dt)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCNode* s2 = getChildByTag(kTagBackground);
|
|
|
|
if ( s2->numberOfRunningActions() == 0 && s2->getGrid() != NULL)
|
|
|
|
s2->setGrid(NULL);;
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
TextLayer::~TextLayer(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
// TextLayer* TextLayer::node()
|
|
|
|
// {
|
|
|
|
// return TextLayer::create();
|
|
|
|
// }
|
|
|
|
|
|
|
|
TextLayer* TextLayer::create()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
TextLayer* pLayer = new TextLayer();
|
|
|
|
pLayer->autorelease();
|
|
|
|
|
|
|
|
return pLayer;
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextLayer::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCLayer::onEnter();
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
2011-05-26 21:01:16 +08:00
|
|
|
void TextLayer::newScene()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
CCScene* s = new EffectTestScene();
|
2012-06-14 15:13:16 +08:00
|
|
|
CCNode* child = TextLayer::create();
|
2012-04-19 14:35:52 +08:00
|
|
|
s->addChild(child);
|
|
|
|
CCDirector::sharedDirector()->replaceScene(s);
|
2011-05-26 21:01:16 +08:00
|
|
|
s->release();
|
|
|
|
}
|
2010-08-23 10:17:29 +08:00
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
void TextLayer::restartCallback(CCObject* pSender)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
newScene();
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
void TextLayer::nextCallback(CCObject* pSender)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
// update the action index
|
|
|
|
actionIdx++;
|
|
|
|
actionIdx = actionIdx % MAX_LAYER;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
newScene();
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
void TextLayer::backCallback(CCObject* pSender)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
// update the action index
|
|
|
|
actionIdx--;
|
|
|
|
int total = MAX_LAYER;
|
|
|
|
if( actionIdx < 0 )
|
2012-04-19 14:35:52 +08:00
|
|
|
actionIdx += total;
|
2010-08-23 10:17:29 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
newScene();
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|