axmol/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h

64 lines
1.3 KiB
C
Raw Normal View History

2013-09-09 17:49:13 +08:00
#ifndef _SHADER_TEST2_H_
#define _SHADER_TEST2_H_
#include "../testBasic.h"
#include "extensions/cocos-ext.h"
2013-09-09 17:49:13 +08:00
#include "../BaseTest.h"
USING_NS_CC_EXT;
class ShaderTestDemo2 : public BaseTest
{
public:
ShaderTestDemo2(void);
2014-05-15 07:55:57 +08:00
virtual std::string title() const { return "Effects on Sprites";}
void restartCallback(Ref* sender);
void nextCallback(Ref* sender);
void backCallback(Ref* sender);
2013-09-09 17:49:13 +08:00
};
class ShaderTestScene2 : public TestScene
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(ShaderTestScene2);
2013-09-09 17:49:13 +08:00
virtual void runThisTest();
};
2014-05-15 04:09:33 +08:00
//
// Effect
//
class EffectSprite;
class Effect : public Ref
2014-04-14 11:52:17 +08:00
{
public:
2014-05-15 04:09:33 +08:00
GLProgramState* getGLProgramState() const { return _glprogramstate; }
virtual void setTarget(EffectSprite *sprite){}
protected:
bool initGLProgramState(const std::string &fragmentFilename);
Effect();
virtual ~Effect();
2014-05-15 04:09:33 +08:00
GLProgramState *_glprogramstate;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
std::string _fragSource;
EventListenerCustom* _backgroundListener;
#endif
2014-04-14 11:52:17 +08:00
};
2014-05-15 04:09:33 +08:00
class EffectSpriteTest : public ShaderTestDemo2
2014-05-14 09:12:58 +08:00
{
public:
2014-05-15 04:09:33 +08:00
CREATE_FUNC(EffectSpriteTest);
EffectSpriteTest();
2014-05-15 07:55:57 +08:00
virtual std::string subtitle() const {return "Different effects on Sprite";}
2014-05-15 04:09:33 +08:00
protected:
ssize_t _vectorIndex;
cocos2d::Vector<Effect*> _effects;
EffectSprite *_sprite;
2014-05-14 09:12:58 +08:00
};
2014-05-07 02:19:51 +08:00
#endif