2012-03-21 13:36:24 +08:00
|
|
|
#ifndef _NODE_TEST_H_
|
|
|
|
#define _NODE_TEST_H_
|
|
|
|
|
|
|
|
////----#include "cocos2d.h"
|
|
|
|
#include "../testBasic.h"
|
2013-06-07 08:12:28 +08:00
|
|
|
#include "../BaseTest.h"
|
2012-03-21 13:36:24 +08:00
|
|
|
|
2013-06-07 08:12:28 +08:00
|
|
|
class TestCocosNodeDemo : public BaseTest
|
2010-08-26 15:09:02 +08:00
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void onEnter();
|
2010-08-26 15:09:02 +08:00
|
|
|
|
2013-07-26 06:53:24 +08:00
|
|
|
void restartCallback(Object* sender);
|
|
|
|
void nextCallback(Object* sender);
|
|
|
|
void backCallback(Object* sender);
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
TestCocosNodeDemo();
|
|
|
|
virtual ~TestCocosNodeDemo();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Test2 : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(Test2);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void onEnter();
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Test4 : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(Test4);
|
2012-06-08 13:55:28 +08:00
|
|
|
void delay2(float dt);
|
|
|
|
void delay4(float dt);
|
2010-08-26 15:09:02 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Test4();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Test5 : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(Test5);
|
2010-08-26 15:09:02 +08:00
|
|
|
|
2014-01-03 07:51:26 +08:00
|
|
|
void addAndRemove(float dt);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Test5();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Test6 : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(Test6);
|
2012-06-08 13:55:28 +08:00
|
|
|
void addAndRemove(float dt);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Test6();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class StressTest1 : public TestCocosNodeDemo
|
|
|
|
{
|
2014-01-03 07:51:26 +08:00
|
|
|
public:
|
|
|
|
CREATE_FUNC(StressTest1);
|
2012-06-08 13:55:28 +08:00
|
|
|
void shouldNotCrash(float dt);
|
2013-06-20 14:17:10 +08:00
|
|
|
void removeMe(Node* node);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
StressTest1();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class StressTest2 : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(StressTest2);
|
|
|
|
void shouldNotLeak(float dt);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
StressTest2();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerTest1 : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(SchedulerTest1);
|
2012-06-08 13:55:28 +08:00
|
|
|
void doSomething(float dt);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
SchedulerTest1();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class NodeToWorld : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(NodeToWorld);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
NodeToWorld();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class CameraOrbitTest : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(CameraOrbitTest);
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
CameraOrbitTest();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class CameraZoomTest : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(CameraZoomTest);
|
2012-06-08 13:55:28 +08:00
|
|
|
void update(float dt);
|
2010-08-26 15:09:02 +08:00
|
|
|
|
2014-01-03 07:51:26 +08:00
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
CameraZoomTest();
|
|
|
|
float _z;
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class CameraCenterTest : public TestCocosNodeDemo
|
|
|
|
{
|
2012-03-21 13:36:24 +08:00
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(CameraCenterTest);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
CameraCenterTest();
|
2010-08-26 15:09:02 +08:00
|
|
|
};
|
|
|
|
|
2014-01-09 08:28:18 +08:00
|
|
|
class CameraTest2 : public TestCocosNodeDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(CameraTest2);
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void update(float dt) override;
|
|
|
|
CameraTest2();
|
|
|
|
|
|
|
|
Sprite *_sprite1;
|
|
|
|
Sprite *_sprite2;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2011-02-23 16:47:25 +08:00
|
|
|
class ConvertToNode : public TestCocosNodeDemo
|
|
|
|
{
|
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(ConvertToNode);
|
2013-10-23 16:14:03 +08:00
|
|
|
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
ConvertToNode();
|
2011-02-23 16:47:25 +08:00
|
|
|
};
|
|
|
|
|
2012-03-21 13:36:24 +08:00
|
|
|
class NodeOpaqueTest : public TestCocosNodeDemo
|
|
|
|
{
|
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(NodeOpaqueTest);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
NodeOpaqueTest();
|
2012-03-21 13:36:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class NodeNonOpaqueTest : public TestCocosNodeDemo
|
|
|
|
{
|
|
|
|
public:
|
2014-01-03 07:51:26 +08:00
|
|
|
CREATE_FUNC(NodeNonOpaqueTest);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2014-01-03 07:51:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
NodeNonOpaqueTest();
|
2012-03-21 13:36:24 +08:00
|
|
|
};
|
|
|
|
|
2010-08-26 15:09:02 +08:00
|
|
|
class CocosNodeTestScene : public TestScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void runThisTest();
|
|
|
|
};
|
|
|
|
|
|
|
|
//CCLayer* nextAction();
|
|
|
|
|
|
|
|
#endif
|