2011-05-26 21:01:16 +08:00
|
|
|
#include "EffectsTest.h"
|
|
|
|
#include "../testResource.h"
|
2013-12-16 14:21:05 +08:00
|
|
|
#include "CCNodeGrid.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
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class Shaky3DDemo : public Shaky3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return Shaky3D::create(t, Size(15,10), 5, false);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class Waves3DDemo : public Waves3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return Waves3D::create(t, Size(15,10), 5, 40);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class FlipX3DDemo : public FlipX3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto flipx = FlipX3D::create(t);
|
|
|
|
auto flipx_back = flipx->reverse();
|
|
|
|
auto delay = DelayTime::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(flipx, delay, flipx_back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class FlipY3DDemo : public FlipY3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto flipy = FlipY3D::create(t);
|
|
|
|
auto flipy_back = flipy->reverse();
|
|
|
|
auto delay = DelayTime::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(flipy, delay, flipy_back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class Lens3DDemo : public Lens3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2013-07-12 14:30:26 +08:00
|
|
|
return Lens3D::create(t, Size(15,10), Point(size.width/2,size.height/2), 240);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class Ripple3DDemo : public Ripple3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2013-07-12 14:30:26 +08:00
|
|
|
return Ripple3D::create(t, Size(32,24), Point(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
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class LiquidDemo : public Liquid
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return Liquid::create(t, Size(16,12), 4, 20);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class WavesDemo : public Waves
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return Waves::create(t, Size(16,12), 4, 20, true, true);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class TwirlDemo : public Twirl
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2013-07-12 14:30:26 +08:00
|
|
|
return Twirl::create(t, Size(12,8), Point(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
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class ShakyTiles3DDemo : public ShakyTiles3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return ShakyTiles3D::create(t, Size(16,12), 5, false) ;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class ShatteredTiles3DDemo : public ShatteredTiles3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return ShatteredTiles3D::create(t, Size(16,12), 5, false);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class ShuffleTilesDemo : public ShuffleTiles
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto shuffle = ShuffleTiles::create(t, Size(16,12), 25);
|
|
|
|
auto shuffle_back = shuffle->reverse();
|
|
|
|
auto delay = DelayTime::create(2);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(shuffle, delay, shuffle_back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class FadeOutTRTilesDemo : public FadeOutTRTiles
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto fadeout = FadeOutTRTiles::create(t, Size(16,12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class FadeOutBLTilesDemo : public FadeOutBLTiles
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto fadeout = FadeOutBLTiles::create(t, Size(16,12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class FadeOutUpTilesDemo : public FadeOutUpTiles
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto fadeout = FadeOutUpTiles::create(t, Size(16,12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class FadeOutDownTilesDemo : public FadeOutDownTiles
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto fadeout = FadeOutDownTiles::create(t, Size(16,12));
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::create(fadeout, delay, back, NULL);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class TurnOffTilesDemo : public TurnOffTiles
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto fadeout = TurnOffTiles::create(t, Size(48,32), 25);
|
|
|
|
auto back = fadeout->reverse();
|
|
|
|
auto delay = DelayTime::create(0.5f);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
return Sequence::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
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class WavesTiles3DDemo : public WavesTiles3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return WavesTiles3D::create(t, Size(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
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class JumpTiles3DDemo : public JumpTiles3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 14:30:26 +08:00
|
|
|
return JumpTiles3D::create(t, Size(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
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class SplitRowsDemo : public SplitRows
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
return SplitRows::create(t, 9);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class SplitColsDemo : public SplitCols
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
return SplitCols::create(t, 9);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2011-05-26 21:01:16 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class PageTurn3DDemo : public PageTurn3D
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static ActionInterval* create(float t)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-07-12 06:24:23 +08:00
|
|
|
Director::getInstance()->setDepthTest(true);
|
2013-07-12 14:30:26 +08:00
|
|
|
return PageTurn3D::create(t, Size(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
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
ActionInterval* createEffect(int nIndex, float t)
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
|
|
|
|
2013-07-12 06:24:23 +08:00
|
|
|
Director::getInstance()->setDepthTest(false);
|
2011-06-27 15:34:26 +08:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
ActionInterval* getAction()
|
2010-08-23 10:17:29 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto 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());
|
2013-07-12 06:24:23 +08:00
|
|
|
Director::getInstance()->replaceScene(this);
|
2011-05-26 21:01:16 +08:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
#define SID_RESTART 1
|
2011-05-26 21:01:16 +08:00
|
|
|
|
|
|
|
TextLayer::TextLayer(void)
|
2013-06-07 14:31:15 +08:00
|
|
|
: BaseTest()
|
2011-05-26 21:01:16 +08:00
|
|
|
{
|
2013-07-05 16:49:22 +08:00
|
|
|
LayerColor *background = LayerColor::create( Color4B(32,128,32,255) );
|
2013-06-07 08:12:28 +08:00
|
|
|
this->addChild(background,-20);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-16 14:21:05 +08:00
|
|
|
_gridNodeTarget = NodeGrid::create();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto effect = getAction();
|
2013-12-10 11:47:40 +08:00
|
|
|
_gridNodeTarget->runAction(effect);
|
|
|
|
addChild(_gridNodeTarget, 0, kTagBackground);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto bg = Sprite::create(s_back3);
|
2013-12-10 11:47:40 +08:00
|
|
|
_gridNodeTarget->addChild(bg, 0);
|
2013-07-12 14:47:36 +08:00
|
|
|
// bg->setAnchorPoint( Point::ZERO );
|
2012-10-23 17:48:50 +08:00
|
|
|
bg->setPosition(VisibleRect::center());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto grossini = Sprite::create(s_pathSister2);
|
2013-12-10 11:47:40 +08:00
|
|
|
_gridNodeTarget->addChild(grossini, 1);
|
2013-07-12 14:11:55 +08:00
|
|
|
grossini->setPosition( Point(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sc = ScaleBy::create(2, 5);
|
|
|
|
auto sc_back = sc->reverse();
|
2013-06-20 14:17:10 +08:00
|
|
|
grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, NULL) ) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto tamara = Sprite::create(s_pathSister1);
|
2013-12-10 11:47:40 +08:00
|
|
|
_gridNodeTarget->addChild(tamara, 1);
|
2013-07-12 14:11:55 +08:00
|
|
|
tamara->setPosition( Point(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sc2 = ScaleBy::create(2, 5);
|
|
|
|
auto sc2_back = sc2->reverse();
|
2013-06-20 14:17:10 +08:00
|
|
|
tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL)) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto label = Label::createWithTTF((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32);
|
2013-07-28 14:33:02 +08:00
|
|
|
|
|
|
|
label->setPosition( Point(VisibleRect::center().x,VisibleRect::top().y-80) );
|
|
|
|
addChild(label);
|
|
|
|
label->setTag( kTagLabel );
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
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
|
|
|
{
|
2013-12-10 11:47:40 +08:00
|
|
|
//auto s2 = getChildByTag(kTagBackground);
|
2013-12-16 14:21:05 +08:00
|
|
|
if ( _gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != NULL)
|
2014-04-09 22:53:59 +08:00
|
|
|
_gridNodeTarget->setGrid(nullptr);;
|
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
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto layer = new TextLayer();
|
2013-07-23 08:25:44 +08:00
|
|
|
layer->autorelease();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-23 08:25:44 +08:00
|
|
|
return layer;
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextLayer::onEnter()
|
|
|
|
{
|
2013-06-07 08:12:28 +08:00
|
|
|
BaseTest::onEnter();
|
2010-08-23 10:17:29 +08:00
|
|
|
}
|
|
|
|
|
2011-05-26 21:01:16 +08:00
|
|
|
void TextLayer::newScene()
|
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = new EffectTestScene();
|
|
|
|
auto child = TextLayer::create();
|
2012-04-19 14:35:52 +08:00
|
|
|
s->addChild(child);
|
2013-07-12 06:24:23 +08:00
|
|
|
Director::getInstance()->replaceScene(s);
|
2011-05-26 21:01:16 +08:00
|
|
|
s->release();
|
|
|
|
}
|
2010-08-23 10:17:29 +08:00
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void TextLayer::restartCallback(Ref* sender)
|
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
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void TextLayer::nextCallback(Ref* sender)
|
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
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void TextLayer::backCallback(Ref* sender)
|
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
|
|
|
}
|