axmol/tests/cpp-tests/Classes/NodeTest/NodeTest.h

281 lines
6.2 KiB
C
Raw Normal View History

/****************************************************************************
Copyright (c) 2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef _NODE_TEST_H_
#define _NODE_TEST_H_
////----#include "cocos2d.h"
#include "../testBasic.h"
#include "../BaseTest.h"
class TestCocosNodeDemo : public BaseTest
2010-08-26 15:09:02 +08:00
{
public:
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void onEnter() override;
2010-08-26 15:09:02 +08:00
void restartCallback(Ref* sender);
void nextCallback(Ref* sender);
void backCallback(Ref* sender);
protected:
TestCocosNodeDemo();
virtual ~TestCocosNodeDemo();
protected:
Director::Projection _preProjection;
2010-08-26 15:09:02 +08:00
};
class Test2 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(Test2);
virtual void onEnter() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
2010-08-26 15:09:02 +08:00
};
class Test4 : public TestCocosNodeDemo
{
public:
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
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
Test4();
2010-08-26 15:09:02 +08:00
};
class Test5 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(Test5);
2010-08-26 15:09:02 +08:00
void addAndRemove(float dt);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
Test5();
2010-08-26 15:09:02 +08:00
};
class Test6 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(Test6);
2012-06-08 13:55:28 +08:00
void addAndRemove(float dt);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
Test6();
2010-08-26 15:09:02 +08:00
};
class StressTest1 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(StressTest1);
2012-06-08 13:55:28 +08:00
void shouldNotCrash(float dt);
void removeMe(Node* node);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
StressTest1();
2010-08-26 15:09:02 +08:00
};
class StressTest2 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(StressTest2);
void shouldNotLeak(float dt);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
StressTest2();
2010-08-26 15:09:02 +08:00
};
class SchedulerTest1 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(SchedulerTest1);
2012-06-08 13:55:28 +08:00
void doSomething(float dt);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
SchedulerTest1();
2010-08-26 15:09:02 +08:00
};
class NodeToWorld : public TestCocosNodeDemo
{
public:
CREATE_FUNC(NodeToWorld);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
NodeToWorld();
2010-08-26 15:09:02 +08:00
};
class NodeToWorld3D : public TestCocosNodeDemo
{
public:
CREATE_FUNC(NodeToWorld3D);
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
NodeToWorld3D();
};
2010-08-26 15:09:02 +08:00
class CameraOrbitTest : public TestCocosNodeDemo
{
public:
CREATE_FUNC(CameraOrbitTest);
virtual void onEnter() override;
virtual void onExit() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
CameraOrbitTest();
2010-08-26 15:09:02 +08:00
};
class CameraZoomTest : public TestCocosNodeDemo
{
public:
CREATE_FUNC(CameraZoomTest);
2012-06-08 13:55:28 +08:00
void update(float dt);
2010-08-26 15:09:02 +08:00
virtual void onEnter() override;
virtual void onExit() override;
2014-02-28 23:02:22 +08:00
virtual std::string subtitle() const override;
protected:
CameraZoomTest();
float _z;
2010-08-26 15:09:02 +08:00
};
class CameraCenterTest : public TestCocosNodeDemo
{
public:
CREATE_FUNC(CameraCenterTest);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void onEnter();
virtual void onExit();
protected:
CameraCenterTest();
2010-08-26 15:09:02 +08:00
};
class CameraTest1 : public TestCocosNodeDemo
{
public:
CREATE_FUNC(CameraTest1);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void onEnter() override;
virtual void onExit() override;
protected:
CameraTest1();
Sprite *_sprite1;
Sprite *_sprite2;
};
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:
CameraTest2();
Sprite *_sprite1;
Sprite *_sprite2;
};
2011-02-23 16:47:25 +08:00
class ConvertToNode : public TestCocosNodeDemo
{
public:
CREATE_FUNC(ConvertToNode);
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
virtual std::string title() const override;
virtual std::string subtitle() const override;
protected:
ConvertToNode();
2011-02-23 16:47:25 +08:00
};
class NodeOpaqueTest : public TestCocosNodeDemo
{
public:
CREATE_FUNC(NodeOpaqueTest);
virtual std::string title() const override;
virtual std::string subtitle() const override;
protected:
NodeOpaqueTest();
};
class NodeNonOpaqueTest : public TestCocosNodeDemo
{
public:
CREATE_FUNC(NodeNonOpaqueTest);
virtual std::string title() const override;
virtual std::string subtitle() const override;
protected:
NodeNonOpaqueTest();
};
class NodeGlobalZValueTest : public TestCocosNodeDemo
{
public:
CREATE_FUNC(NodeGlobalZValueTest);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual void update(float dt) override;
protected:
NodeGlobalZValueTest();
Sprite *_sprite;
};
2010-08-26 15:09:02 +08:00
class CocosNodeTestScene : public TestScene
{
public:
virtual void runThisTest();
};
//CCLayer* nextAction();
#endif