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

225 lines
4.9 KiB
C
Raw Normal View History

2012-11-21 15:22:54 +08:00
#ifndef __CLIPPINGNODETEST_H__
#define __CLIPPINGNODETEST_H__
#include "../testBasic.h"
#include "../BaseTest.h"
2012-11-21 15:22:54 +08:00
class BaseClippingNodeTest : public BaseTest
2012-11-21 15:22:54 +08:00
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(BaseClippingNodeTest);
2012-11-21 15:22:54 +08:00
~BaseClippingNodeTest();
virtual bool init();
virtual std::string title();
virtual std::string subtitle();
virtual void setup();
void backCallback(Object* sender);
void nextCallback(Object* sender);
void restartCallback(Object* sender);
2012-11-21 15:22:54 +08:00
};
class BasicTest : public BaseClippingNodeTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(BasicTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual void setup();
virtual Action* actionRotate();
virtual Action* actionScale();
2012-11-21 15:22:54 +08:00
virtual DrawNode* shape();
virtual Sprite* grossini();
2012-11-21 15:22:54 +08:00
virtual Node* stencil();
virtual ClippingNode* clipper();
virtual Node* content();
2012-11-21 15:22:54 +08:00
};
class ShapeTest : public BasicTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ShapeTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual Node* stencil();
virtual Node* content();
2012-11-21 15:22:54 +08:00
};
class ShapeInvertedTest : public ShapeTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ShapeInvertedTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual ClippingNode* clipper();
2012-11-21 15:22:54 +08:00
};
class SpriteTest : public BasicTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual Node* stencil();
virtual ClippingNode* clipper();
virtual Node* content();
2012-11-21 15:22:54 +08:00
};
class SpriteNoAlphaTest : public SpriteTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteNoAlphaTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual ClippingNode* clipper();
2012-11-21 15:22:54 +08:00
};
class SpriteInvertedTest : public SpriteTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteInvertedTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual ClippingNode* clipper();
2012-11-21 15:22:54 +08:00
};
class NestedTest : public BaseClippingNodeTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(NestedTest);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual void setup();
};
class HoleDemo : public BaseClippingNodeTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(HoleDemo);
2012-11-21 15:22:54 +08:00
~HoleDemo();
virtual void setup();
virtual std::string title();
virtual std::string subtitle();
void pokeHoleAtPoint(Point point);
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
2012-11-21 15:22:54 +08:00
private:
ClippingNode* _outerClipper;
Node* _holes;
Node* _holesStencil;
2012-11-21 15:22:54 +08:00
};
class ScrollViewDemo : public BaseClippingNodeTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ScrollViewDemo);
2012-11-21 15:22:54 +08:00
virtual std::string title();
virtual std::string subtitle();
virtual void setup();
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
void onTouchesMoved(const std::vector<Touch*>& touches, Event *event);
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
2012-11-21 15:22:54 +08:00
private:
bool _scrolling;
Point _lastPoint;
2012-11-21 15:22:54 +08:00
};
//#if COCOS2D_DEBUG > 1
class RawStencilBufferTest : public BaseClippingNodeTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RawStencilBufferTest);
2012-11-21 15:22:54 +08:00
~RawStencilBufferTest();
virtual std::string title();
virtual std::string subtitle();
virtual void setup();
virtual void draw();
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
2012-11-21 15:36:48 +08:00
protected:
Sprite* _sprite;
2012-11-21 15:22:54 +08:00
};
class RawStencilBufferTest2 : public RawStencilBufferTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RawStencilBufferTest2);
2012-11-21 15:22:54 +08:00
virtual std::string subtitle();
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
};
class RawStencilBufferTest3 : public RawStencilBufferTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RawStencilBufferTest3);
2012-11-21 15:22:54 +08:00
virtual std::string subtitle();
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
};
class RawStencilBufferTest4 : public RawStencilBufferTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RawStencilBufferTest4);
2012-11-21 15:22:54 +08:00
virtual std::string subtitle();
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
};
class RawStencilBufferTest5 : public RawStencilBufferTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RawStencilBufferTest5);
2012-11-21 15:22:54 +08:00
virtual std::string subtitle();
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
};
class RawStencilBufferTest6 : public RawStencilBufferTest
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RawStencilBufferTest6);
2012-11-21 15:22:54 +08:00
virtual std::string subtitle();
virtual void setup();
virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane);
};
//#endif //COCOS2D_DEBUG > 1
class ClippingNodeTestScene : public TestScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ClippingNodeTestScene);
2012-11-21 15:22:54 +08:00
virtual void runThisTest();
};
#endif //__CLIPPINGNODETEST_H__