axmol/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.h

587 lines
12 KiB
C
Raw Normal View History

#ifndef _ActionsTest_H_
#define _ActionsTest_H_
#include "../testBasic.h"
#include "../BaseTest.h"
////----#include "cocos2d.h"
USING_NS_CC;
// 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();
};
class ActionsDemo : public BaseTest
{
protected:
Sprite* _grossini;
Sprite* _tamara;
Sprite* _kathia;
public:
virtual void onEnter();
virtual void onExit();
void centerSprites(unsigned int numberOfSprites);
void alignSpritesLeft(unsigned int numberOfSprites);
virtual std::string title() const override;
virtual std::string subtitle() const override;
void restartCallback(Object* sender);
void nextCallback(Object* sender);
void backCallback(Object* sender);
};
class ActionManual : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionManual);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionMove : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionMove);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionScale : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionScale);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionSkew : public ActionsDemo
{
2012-11-19 17:15:16 +08:00
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionSkew);
2012-11-19 17:15:16 +08:00
virtual void onEnter();
virtual std::string subtitle() const override;
2012-11-19 17:15:16 +08:00
};
class ActionRotationalSkew : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRotationalSkew);
2012-11-19 17:15:16 +08:00
virtual void onEnter();
virtual std::string subtitle() const override;
2012-11-19 17:15:16 +08:00
};
class ActionRotationalSkewVSStandardSkew : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRotationalSkewVSStandardSkew);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionSkewRotateScale : public ActionsDemo
{
2012-11-19 17:15:16 +08:00
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionSkewRotateScale);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionRotate : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRotate);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionJump : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionJump);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionBezier : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionBezier);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionBlink : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionBlink);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionFade : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionFade);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionTint : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionTint);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionAnimate : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionAnimate);
virtual void onEnter();
virtual void onExit();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class ActionSequence : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionSequence);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionSequence2 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionSequence2);
virtual void onEnter();
virtual std::string subtitle() const override;
void callback1();
void callback2(Node* sender);
void callback3(Node* sender, long data);
};
class ActionSpawn : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionSpawn);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionReverse : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionReverse);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionRepeat : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRepeat);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionDelayTime : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionDelayTime);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionReverseSequence : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionReverseSequence);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionReverseSequence2 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionReverseSequence2);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionOrbit : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionOrbit);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionRemoveSelf : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRemoveSelf);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionRepeatForever : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRepeatForever);
virtual void onEnter();
virtual std::string subtitle() const override;
void repeatForever(Node* pTarget);
};
class ActionRotateToRepeat : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRotateToRepeat);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionRotateJerk : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionRotateJerk);
virtual void onEnter();
virtual std::string subtitle() const override;
};
class ActionCallFuncN : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCallFuncN);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void callback(Node* sender);
};
class ActionCallFuncND : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCallFuncND);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void doRemoveFromParentAndCleanup(Node* sender, bool cleanup);
};
class ActionCallFuncO : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCallFuncO);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void callback(Node* object, bool cleanup);
};
class ActionCallFunction : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCallFunction);
virtual void onEnter();
virtual std::string subtitle() const override;
void callback1();
void callback2(Node* pTarget);
void callback3(Node* pTarget, long data);
};
class ActionFollow : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionFollow);
virtual void onEnter();
virtual void draw();
virtual std::string subtitle() const override;
protected:
void onDraw();
private:
CustomCommand _customCommand;
};
class ActionTargeted : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionTargeted);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class ActionTargetedReverse : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionTargetedReverse);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2013-02-28 14:42:45 +08:00
class ActionStacked : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionStacked);
2013-02-28 14:42:45 +08:00
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void addNewSpriteWithCoords(Point p);
virtual void runActionsInSprite(Sprite* sprite);
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
2013-02-28 14:42:45 +08:00
};
class ActionMoveStacked : public ActionStacked
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionMoveStacked);
virtual std::string title() const override;
virtual void runActionsInSprite(Sprite* sprite);
2013-02-28 14:42:45 +08:00
};
class ActionMoveJumpStacked : public ActionStacked
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionMoveJumpStacked);
virtual std::string title() const override;
virtual void runActionsInSprite(Sprite* sprite);
2013-02-28 14:42:45 +08:00
};
class ActionMoveBezierStacked : public ActionStacked
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionMoveBezierStacked);
virtual std::string title() const override;
virtual void runActionsInSprite(Sprite* sprite);
2013-02-28 14:42:45 +08:00
};
class ActionCatmullRomStacked : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCatmullRomStacked);
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() const override;
virtual std::string subtitle() const override;
protected:
//cached data and callback
kmMat4 _modelViewMV1;
kmMat4 _modelViewMV2;
void onDraw();
2013-02-28 14:42:45 +08:00
private:
PointArray* _array1;
PointArray* _array2;
CustomCommand _customCommand;
2013-02-28 14:42:45 +08:00
};
class ActionCardinalSplineStacked : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCardinalSplineStacked);
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() const override;
virtual std::string subtitle() const override;
2013-02-28 14:42:45 +08:00
private:
PointArray* _array;
protected:
void onDraw();
kmMat4 _modelViewMV1;
kmMat4 _modelViewMV2;
CustomCommand _customCommand;
2013-02-28 14:42:45 +08:00
};
class Issue1305 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(Issue1305);
virtual void onEnter();
virtual void onExit();
void log(Node* sender);
2012-06-08 13:55:28 +08:00
void addSprite(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
private:
Sprite* _spriteTmp;
};
class Issue1305_2 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(Issue1305_2);
virtual void onEnter();
void printLog1();
void printLog2();
void printLog3();
void printLog4();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Issue1288 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(Issue1288);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Issue1288_2 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(Issue1288_2);
virtual void onEnter();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Issue1327 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(Issue1327);
virtual void onEnter();
virtual std::string subtitle() const override;
virtual std::string title() const override;
void logSprRotation(Sprite* sender);
};
2012-11-19 17:15:16 +08:00
class Issue1398 : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(Issue1398);
2012-11-19 17:15:16 +08:00
void incrementInteger();
void incrementIntegerCallback(void* data);
2012-11-19 17:15:16 +08:00
virtual void onEnter();
virtual std::string subtitle() const override;
virtual std::string title() const override;
2012-11-19 17:15:16 +08:00
private:
int _testInteger;
2012-11-19 17:15:16 +08:00
};
class ActionCatmullRom : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCatmullRom);
~ActionCatmullRom();
virtual void onEnter();
virtual void draw();
virtual std::string subtitle() const override;
virtual std::string title() const override;
private:
PointArray *_array1;
PointArray *_array2;
protected:
void onDraw();
kmMat4 _modelViewMV1;
kmMat4 _modelViewMV2;
CustomCommand _customCommand;
};
class ActionCardinalSpline : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ActionCardinalSpline);
~ActionCardinalSpline();
virtual void onEnter();
virtual void draw();
virtual std::string subtitle() const override;
virtual std::string title() const override;
private:
PointArray *_array;
protected:
void onDraw();
kmMat4 _modelViewMV1;
kmMat4 _modelViewMV2;
CustomCommand _customCommand;
};
class PauseResumeActions : public ActionsDemo
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(PauseResumeActions);
PauseResumeActions();
virtual ~PauseResumeActions();
virtual void onEnter();
virtual std::string subtitle() const override;
virtual std::string title() const override;
void pause(float dt);
void resume(float dt);
private:
2013-12-07 14:28:37 +08:00
Vector<Node*> _pausedTargets;
};
#endif