2010-09-10 10:29:39 +08:00
|
|
|
#ifndef _RENDERTEXTURE_TEST_H_
|
|
|
|
#define _RENDERTEXTURE_TEST_H_
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
#include "../testBasic.h"
|
2013-06-08 08:21:11 +08:00
|
|
|
#include "../BaseTest.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-08 08:21:11 +08:00
|
|
|
class RenderTextureTest : public BaseTest
|
2010-09-10 10:29:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void onEnter();
|
2011-02-25 11:31:49 +08:00
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void restartCallback(CCObject* pSender);
|
|
|
|
void nextCallback(CCObject* pSender);
|
2011-03-07 17:11:57 +08:00
|
|
|
void backCallback(CCObject* pSender);
|
2011-02-25 11:31:49 +08:00
|
|
|
};
|
|
|
|
|
2012-06-14 18:37:57 +08:00
|
|
|
class RenderTextureSave : public RenderTextureTest
|
2011-08-08 14:06:03 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
RenderTextureSave();
|
|
|
|
~RenderTextureSave();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
virtual void ccTouchesMoved(CCSet* touches, CCEvent* event);
|
|
|
|
void clearImage(CCObject *pSender);
|
|
|
|
void saveImage(CCObject *pSender);
|
2011-08-08 14:06:03 +08:00
|
|
|
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
CCRenderTexture *_target;
|
|
|
|
CCSprite *_brush;
|
2011-08-08 14:06:03 +08:00
|
|
|
};
|
|
|
|
|
2012-06-14 18:37:57 +08:00
|
|
|
class RenderTextureIssue937 : public RenderTextureTest
|
2011-02-25 11:31:49 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
RenderTextureIssue937();
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
};
|
|
|
|
|
2010-09-10 10:29:39 +08:00
|
|
|
class RenderTextureScene : public TestScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void runThisTest();
|
|
|
|
};
|
|
|
|
|
2012-06-14 18:37:57 +08:00
|
|
|
class RenderTextureZbuffer : public RenderTextureTest
|
2011-07-08 16:27:13 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
RenderTextureZbuffer();
|
2011-07-08 16:27:13 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void ccTouchesMoved(CCSet* touches, CCEvent* event);
|
|
|
|
virtual void ccTouchesBegan(CCSet* touches, CCEvent* event);
|
|
|
|
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
2011-07-08 16:27:13 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void renderScreenShot();
|
2011-07-08 16:27:13 +08:00
|
|
|
|
|
|
|
private:
|
2012-04-19 14:35:52 +08:00
|
|
|
cocos2d::CCSpriteBatchNode *mgr;;
|
2011-07-08 16:27:13 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
cocos2d::CCSprite *sp1;
|
|
|
|
cocos2d::CCSprite *sp2;
|
|
|
|
cocos2d::CCSprite *sp3;
|
|
|
|
cocos2d::CCSprite *sp4;
|
|
|
|
cocos2d::CCSprite *sp5;
|
|
|
|
cocos2d::CCSprite *sp6;
|
|
|
|
cocos2d::CCSprite *sp7;
|
|
|
|
cocos2d::CCSprite *sp8;
|
|
|
|
cocos2d::CCSprite *sp9;
|
2011-07-08 16:27:13 +08:00
|
|
|
};
|
|
|
|
|
2012-06-14 18:37:57 +08:00
|
|
|
class RenderTextureTestDepthStencil : public RenderTextureTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RenderTextureTestDepthStencil();
|
2012-06-12 15:55:23 +08:00
|
|
|
virtual std::string title();
|
2012-06-14 18:37:57 +08:00
|
|
|
virtual std::string subtitle();
|
2012-06-12 15:55:23 +08:00
|
|
|
};
|
|
|
|
|
2012-11-20 16:45:59 +08:00
|
|
|
class RenderTextureTargetNode : public RenderTextureTest
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
cocos2d::CCSprite *sprite1, *sprite2;
|
|
|
|
cocos2d::CCRenderTexture *renderTexture;
|
|
|
|
public:
|
|
|
|
RenderTextureTargetNode();
|
|
|
|
|
|
|
|
virtual void update(float t);
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
2013-02-28 16:35:42 +08:00
|
|
|
void touched(CCObject* sender);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpriteRenderTextureBug : public RenderTextureTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
class SimpleSprite : public CCSprite
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SimpleSprite();
|
|
|
|
virtual void draw();
|
|
|
|
|
|
|
|
static SimpleSprite* create(const char* filename, const CCRect &rect);
|
|
|
|
|
|
|
|
public:
|
|
|
|
CCRenderTexture *rt;
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
SpriteRenderTextureBug();
|
|
|
|
|
|
|
|
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);
|
|
|
|
virtual std::string title();
|
|
|
|
virtual std::string subtitle();
|
|
|
|
|
|
|
|
SimpleSprite* addNewSpriteWithCoords(const CCPoint& p);
|
2012-11-20 16:45:59 +08:00
|
|
|
};
|
|
|
|
|
2010-09-10 10:29:39 +08:00
|
|
|
#endif
|