2012-04-19 14:35:52 +08:00
|
|
|
#ifndef _ActionsTest_H_
|
|
|
|
#define _ActionsTest_H_
|
|
|
|
|
|
|
|
#include "../testBasic.h"
|
2013-06-07 08:12:28 +08:00
|
|
|
#include "../BaseTest.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
////----#include "cocos2d.h"
|
|
|
|
|
2012-06-14 05:19:13 +08:00
|
|
|
USING_NS_CC;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ACTION_MANUAL_LAYER = 0,
|
|
|
|
ACTION_MOVE_LAYER,
|
|
|
|
ACTION_SCALE_LAYER,
|
|
|
|
ACTION_ROTATE_LAYER,
|
|
|
|
ACTION_SKEW_LAYER,
|
2012-11-19 17:15:16 +08:00
|
|
|
ACTION_ROTATIONAL_SKEW_LAYER,
|
|
|
|
ACTION_ROTATIONAL_SKEW_VS_STANDARD_SKEW_LAYER,
|
2012-04-19 14:35:52 +08:00
|
|
|
ACTION_SKEWROTATE_LAYER,
|
|
|
|
ACTION_JUMP_LAYER,
|
2012-06-11 18:25:57 +08:00
|
|
|
ACTION_CARDINALSPLINE_LAYER,
|
|
|
|
ACTION_CATMULLROM_LAYER,
|
2012-04-19 14:35:52 +08:00
|
|
|
ACTION_BEZIER_LAYER,
|
|
|
|
ACTION_BLINK_LAYER,
|
|
|
|
ACTION_FADE_LAYER,
|
|
|
|
ACTION_TINT_LAYER,
|
|
|
|
ACTION_ANIMATE_LAYER,
|
|
|
|
ACTION_SEQUENCE_LAYER,
|
|
|
|
ACTION_SEQUENCE2_LAYER,
|
|
|
|
ACTION_SPAWN_LAYER,
|
|
|
|
ACTION_REVERSE,
|
|
|
|
ACTION_DELAYTIME_LAYER,
|
|
|
|
ACTION_REPEAT_LAYER,
|
|
|
|
ACTION_REPEATEFOREVER_LAYER,
|
|
|
|
ACTION_ROTATETOREPEATE_LAYER,
|
|
|
|
ACTION_ROTATEJERK_LAYER,
|
|
|
|
ACTION_CALLFUNC_LAYER,
|
|
|
|
ACTION_CALLFUNCND_LAYER,
|
2013-06-04 03:13:24 +08:00
|
|
|
ACTION_CALLFUNCTION_LAYER,
|
2012-04-19 14:35:52 +08:00
|
|
|
ACTION_REVERSESEQUENCE_LAYER,
|
|
|
|
ACTION_REVERSESEQUENCE2_LAYER,
|
|
|
|
ACTION_ORBIT_LAYER,
|
|
|
|
ACTION_FLLOW_LAYER,
|
|
|
|
ACTION_TARGETED_LAYER,
|
2012-06-11 18:25:57 +08:00
|
|
|
PAUSERESUMEACTIONS_LAYER,
|
2012-04-19 14:35:52 +08:00
|
|
|
ACTION_ISSUE1305_LAYER,
|
|
|
|
ACTION_ISSUE1305_2_LAYER,
|
|
|
|
ACTION_ISSUE1288_LAYER,
|
|
|
|
ACTION_ISSUE1288_2_LAYER,
|
|
|
|
ACTION_ISSUE1327_LAYER,
|
2012-11-19 17:15:16 +08:00
|
|
|
ACTION_ISSUE1398_LAYER,
|
2012-04-19 14:35:52 +08:00
|
|
|
ACTION_LAYER_COUNT,
|
2013-04-01 10:18:26 +08:00
|
|
|
ACTION_REMOVE_SELF,
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// the class inherit from TestScene
|
|
|
|
// every Scene each test used must inherit from TestScene,
|
|
|
|
// make sure the test have the menu item for back to main menu
|
|
|
|
class ActionsTestScene : public TestScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void runThisTest();
|
|
|
|
};
|
|
|
|
|
2013-06-07 08:12:28 +08:00
|
|
|
class ActionsDemo : public BaseTest
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
CCSprite* _grossini;
|
|
|
|
CCSprite* _tamara;
|
|
|
|
CCSprite* _kathia;
|
2012-04-19 14:35:52 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void onExit();
|
|
|
|
|
|
|
|
void centerSprites(unsigned int numberOfSprites);
|
|
|
|
void alignSpritesLeft(unsigned int numberOfSprites);
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
|
|
|
void restartCallback(CCObject* pSender);
|
|
|
|
void nextCallback(CCObject* pSender);
|
|
|
|
void backCallback(CCObject* pSender);
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionManual : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionMove : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionScale : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionSkew : public ActionsDemo
|
|
|
|
{
|
2012-11-19 17:15:16 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionRotationalSkew : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionRotationalSkewVSStandardSkew : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionSkewRotateScale : public ActionsDemo
|
|
|
|
{
|
2012-11-19 17:15:16 +08:00
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionRotate : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionJump : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionBezier : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
2010-08-09 18:07:50 +08:00
|
|
|
class ActionBlink : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-08-09 18:07:50 +08:00
|
|
|
class ActionFade : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionTint : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-08-09 18:07:50 +08:00
|
|
|
class ActionAnimate : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void onExit();
|
|
|
|
virtual std::string title();
|
2010-08-09 18:07:50 +08:00
|
|
|
virtual std::string subtitle();
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-08-09 18:07:50 +08:00
|
|
|
class ActionSequence : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionSequence2 : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual std::string subtitle();
|
2010-08-11 15:54:44 +08:00
|
|
|
|
|
|
|
void callback1();
|
2010-09-03 11:10:32 +08:00
|
|
|
void callback2(CCNode* sender);
|
2012-04-19 14:35:52 +08:00
|
|
|
void callback3(CCNode* sender, void* data);
|
|
|
|
};
|
2010-08-09 18:07:50 +08:00
|
|
|
|
|
|
|
class ActionSpawn : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionReverse : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionRepeat : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionDelayTime : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionReverseSequence : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionReverseSequence2 : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionOrbit : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
2013-04-01 10:18:26 +08:00
|
|
|
class ActionRemoveSelf : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
2010-08-09 18:07:50 +08:00
|
|
|
class ActionRepeatForever : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
|
|
|
void repeatForever(CCNode* pTarget);
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionRotateToRepeat : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionRotateJerk : public ActionsDemo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2010-08-09 18:07:50 +08:00
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ActionCallFunc : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
2010-08-11 15:54:44 +08:00
|
|
|
void callback1();
|
|
|
|
void callback2(CCNode* pTarget);
|
2012-04-19 14:35:52 +08:00
|
|
|
void callback3(CCNode* pTarget, void* data);
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionCallFuncND : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
void removeFromParentAndCleanup(CCNode* pSender, void* data);
|
|
|
|
};
|
|
|
|
|
2013-06-04 03:13:24 +08:00
|
|
|
class ActionCallFunction : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
|
|
|
void callback1();
|
|
|
|
void callback2(CCNode* pTarget);
|
|
|
|
void callback3(CCNode* pTarget, void* data);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
class ActionFollow : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
2013-03-01 11:12:23 +08:00
|
|
|
virtual void draw();
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionTargeted : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
2013-02-28 14:42:45 +08:00
|
|
|
class ActionStacked : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual void addNewSpriteWithCoords(CCPoint p);
|
|
|
|
virtual void runActionsInSprite(CCSprite* sprite);
|
|
|
|
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionMoveStacked : public ActionStacked
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual std::string title();
|
|
|
|
virtual void runActionsInSprite(CCSprite* sprite);
|
|
|
|
};
|
|
|
|
|
|
|
|
class ActionMoveJumpStacked : public ActionStacked
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual std::string title();
|
2013-02-28 15:32:27 +08:00
|
|
|
virtual void runActionsInSprite(CCSprite* sprite);
|
2013-02-28 14:42:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ActionMoveBezierStacked : public ActionStacked
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual std::string title();
|
2013-02-28 15:32:27 +08:00
|
|
|
virtual void runActionsInSprite(CCSprite* sprite);
|
2013-02-28 14:42:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ActionCatmullRomStacked : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
2013-02-28 15:32:27 +08:00
|
|
|
virtual ~ActionCatmullRomStacked();
|
|
|
|
virtual void draw();
|
2013-02-28 14:42:45 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
private:
|
|
|
|
CCPointArray* _array1;
|
2013-02-28 15:32:27 +08:00
|
|
|
CCPointArray* _array2;
|
2013-02-28 14:42:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ActionCardinalSplineStacked : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
2013-02-28 15:32:27 +08:00
|
|
|
virtual ~ActionCardinalSplineStacked();
|
|
|
|
virtual void draw();
|
2013-02-28 14:42:45 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
private:
|
|
|
|
CCPointArray* _array;
|
|
|
|
};
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
class Issue1305 : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void onExit();
|
|
|
|
void log(CCNode* pSender);
|
2012-06-08 13:55:28 +08:00
|
|
|
void addSprite(float dt);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
CCSprite* _spriteTmp;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Issue1305_2 : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
2012-10-26 04:40:37 +08:00
|
|
|
void printLog1();
|
|
|
|
void printLog2();
|
|
|
|
void printLog3();
|
|
|
|
void printLog4();
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class Issue1288 : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class Issue1288_2 : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
|
|
|
class Issue1327 : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual std::string title();
|
|
|
|
void logSprRotation(CCNode* pSender);
|
|
|
|
};
|
|
|
|
|
2012-11-19 17:15:16 +08:00
|
|
|
class Issue1398 : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void incrementInteger();
|
2013-06-04 03:13:24 +08:00
|
|
|
void incrementIntegerCallback(void* data);
|
2012-11-19 17:15:16 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual std::string title();
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
int _testInteger;
|
2012-11-19 17:15:16 +08:00
|
|
|
};
|
|
|
|
|
2012-06-11 18:25:57 +08:00
|
|
|
class ActionCatmullRom : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~ActionCatmullRom();
|
|
|
|
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void draw();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual std::string title();
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
CCPointArray *_array1;
|
|
|
|
CCPointArray *_array2;
|
2012-06-11 18:25:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ActionCardinalSpline : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~ActionCardinalSpline();
|
|
|
|
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void draw();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual std::string title();
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
CCPointArray *_array;
|
2012-06-11 18:25:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class PauseResumeActions : public ActionsDemo
|
|
|
|
{
|
|
|
|
public:
|
2012-07-24 11:21:08 +08:00
|
|
|
PauseResumeActions();
|
|
|
|
virtual ~PauseResumeActions();
|
2012-06-11 18:25:57 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual std::string title();
|
|
|
|
|
|
|
|
void pause(float dt);
|
|
|
|
void resume(float dt);
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
CCSet *_pausedTargets;
|
2012-06-11 18:25:57 +08:00
|
|
|
};
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
#endif
|