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

134 lines
3.3 KiB
C
Raw Normal View History

2010-09-10 10:29:39 +08:00
#ifndef _RENDERTEXTURE_TEST_H_
#define _RENDERTEXTURE_TEST_H_
#include "cocos2d.h"
#include "../testBasic.h"
#include "../BaseTest.h"
class RenderTextureTest : public BaseTest
2010-09-10 10:29:39 +08:00
{
public:
virtual void onEnter();
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 RenderTextureSave : public RenderTextureTest
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(RenderTextureSave);
RenderTextureSave();
~RenderTextureSave();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void onTouchesMoved(const std::vector<Touch*>& touches, Event* event);
void clearImage(Object *pSender);
void saveImage(Object *pSender);
private:
RenderTexture *_target;
Sprite *_brush;
};
class RenderTextureIssue937 : public RenderTextureTest
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(RenderTextureIssue937);
RenderTextureIssue937();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2010-09-10 10:29:39 +08:00
class RenderTextureScene : public TestScene
{
public:
virtual void runThisTest();
};
class RenderTextureZbuffer : public RenderTextureTest
2011-07-08 16:27:13 +08:00
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(RenderTextureZbuffer);
RenderTextureZbuffer();
2011-07-08 16:27:13 +08:00
void onTouchesMoved(const std::vector<Touch*>& touches, Event* event);
void onTouchesBegan(const std::vector<Touch*>& touches, Event* event);
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2011-07-08 16:27:13 +08:00
void renderScreenShot();
2011-07-08 16:27:13 +08:00
private:
cocos2d::SpriteBatchNode *mgr;;
cocos2d::Sprite *sp1;
cocos2d::Sprite *sp2;
cocos2d::Sprite *sp3;
cocos2d::Sprite *sp4;
cocos2d::Sprite *sp5;
cocos2d::Sprite *sp6;
cocos2d::Sprite *sp7;
cocos2d::Sprite *sp8;
cocos2d::Sprite *sp9;
2011-07-08 16:27:13 +08:00
};
class RenderTextureTestDepthStencil : public RenderTextureTest
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(RenderTextureTestDepthStencil);
RenderTextureTestDepthStencil();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2012-11-20 16:45:59 +08:00
class RenderTextureTargetNode : public RenderTextureTest
{
private:
cocos2d::Sprite *sprite1, *sprite2;
cocos2d::RenderTexture *renderTexture;
2012-11-20 16:45:59 +08:00
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(RenderTextureTargetNode);
2012-11-20 16:45:59 +08:00
RenderTextureTargetNode();
virtual void update(float t);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2012-11-20 16:45:59 +08:00
void touched(Object* sender);
2013-02-28 16:35:42 +08:00
};
class SpriteRenderTextureBug : public RenderTextureTest
{
public:
2013-11-14 09:36:33 +08:00
class SimpleSprite : public Sprite
{
2013-02-28 16:35:42 +08:00
public:
2013-11-14 09:36:33 +08:00
static SimpleSprite* create(const char* filename, const Rect &rect);
2013-02-28 16:35:42 +08:00
SimpleSprite();
virtual void draw();
2013-12-25 16:18:29 +08:00
protected:
void onBeforeDraw();
2013-02-28 16:35:42 +08:00
public:
RenderTexture *_rt;
2013-11-14 09:36:33 +08:00
};
2013-02-28 16:35:42 +08:00
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(SpriteRenderTextureBug);
2013-02-28 16:35:42 +08:00
SpriteRenderTextureBug();
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-02-28 16:35:42 +08:00
SimpleSprite* addNewSpriteWithCoords(const Point& p);
2012-11-20 16:45:59 +08:00
};
2010-09-10 10:29:39 +08:00
#endif