2015-04-23 18:03:03 +08:00
|
|
|
#ifndef __cocos2d_tests__SpritePolygonTest__
|
|
|
|
#include "../testBasic.h"
|
|
|
|
#include "../BaseTest.h"
|
2015-05-29 15:03:36 +08:00
|
|
|
#include "2d/CCSpritePolygon.h"
|
2015-04-23 18:03:03 +08:00
|
|
|
DEFINE_TEST_SUITE(SpritePolygonTest);
|
|
|
|
|
2015-04-28 15:18:40 +08:00
|
|
|
class SpritePolygonTestCase : public TestCase
|
2015-04-23 18:03:03 +08:00
|
|
|
{
|
|
|
|
protected:
|
2015-04-24 17:39:43 +08:00
|
|
|
virtual void onBackCallback(Ref* sender);
|
|
|
|
std::string _title;
|
|
|
|
std::string _subtitle;
|
|
|
|
virtual std::string title() const override {return _title;};
|
|
|
|
virtual std::string subtitle() const override {return _subtitle;};
|
2015-04-23 18:03:03 +08:00
|
|
|
};
|
|
|
|
|
2015-04-28 15:18:40 +08:00
|
|
|
class SpritePolygonTestDemo : public SpritePolygonTestCase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void initDefaultSprite(const std::string &filename, cocos2d::experimental::SpritePolygon *inst);
|
|
|
|
protected:
|
|
|
|
cocos2d::experimental::SpritePolygon* spp;
|
|
|
|
cocos2d::Sprite* sp;
|
|
|
|
cocos2d::DrawNode *debugForNormalSprite;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpritePolygonPerformance : public SpritePolygonTestCase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SpritePolygonPerformance);
|
|
|
|
SpritePolygonPerformance();
|
|
|
|
virtual void update(float dt);
|
|
|
|
protected:
|
|
|
|
int spriteCount;
|
|
|
|
int vertCount;
|
|
|
|
int triCount;
|
|
|
|
int pixelCount;
|
|
|
|
float elapsedTime;
|
|
|
|
cocos2d::Label * perfLabel;
|
|
|
|
void updateLabel();
|
|
|
|
int continuousLowDt;
|
|
|
|
float continuousHighDtTime;
|
|
|
|
float waitingTime;
|
|
|
|
|
|
|
|
int _posX;
|
|
|
|
int _posY;
|
|
|
|
int _leftX;
|
|
|
|
int _rightX;
|
|
|
|
bool goRight;
|
|
|
|
bool ended;
|
|
|
|
|
|
|
|
float prevDt;
|
|
|
|
|
|
|
|
virtual Node* makeSprite();
|
|
|
|
virtual void incrementStats();
|
|
|
|
|
|
|
|
void initIncrementStats();
|
|
|
|
int _incVert;
|
|
|
|
int _incTri;
|
|
|
|
int _incPix;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpritePolygonPerformanceTestStatic : public SpritePolygonPerformance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SpritePolygonPerformanceTestStatic);
|
|
|
|
SpritePolygonPerformanceTestStatic();
|
|
|
|
protected:
|
|
|
|
cocos2d::experimental::SpritePolygon* makeSprite();
|
|
|
|
void initIncrementStats();
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpritePerformanceTestStatic : public SpritePolygonPerformance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SpritePerformanceTestStatic);
|
|
|
|
SpritePerformanceTestStatic();
|
|
|
|
protected:
|
|
|
|
cocos2d::Sprite* makeSprite();
|
|
|
|
void initIncrementStats();
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpritePolygonPerformanceTestDynamic : public SpritePolygonPerformanceTestStatic
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SpritePolygonPerformanceTestDynamic);
|
|
|
|
SpritePolygonPerformanceTestDynamic();
|
|
|
|
protected:
|
|
|
|
cocos2d::experimental::SpritePolygon* makeSprite();
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpritePerformanceTestDynamic : public SpritePerformanceTestStatic
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SpritePerformanceTestDynamic);
|
|
|
|
SpritePerformanceTestDynamic();
|
|
|
|
protected:
|
|
|
|
cocos2d::Sprite* makeSprite();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-23 18:03:03 +08:00
|
|
|
class SpritePolygonTest1 : public SpritePolygonTestDemo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SpritePolygonTest1);
|
|
|
|
SpritePolygonTest1();
|
2015-04-24 18:17:12 +08:00
|
|
|
};
|
2015-04-23 18:03:03 +08:00
|
|
|
|
2015-05-19 11:25:53 +08:00
|
|
|
//class SpritePolygonTest2 : public SpritePolygonTestDemo
|
|
|
|
//{
|
|
|
|
//public:
|
|
|
|
// CREATE_FUNC(SpritePolygonTest2);
|
|
|
|
// SpritePolygonTest2();
|
|
|
|
//};
|
|
|
|
//
|
|
|
|
//class SpritePolygonTest3 : public SpritePolygonTestDemo
|
|
|
|
//{
|
|
|
|
//public:
|
|
|
|
// CREATE_FUNC(SpritePolygonTest3);
|
|
|
|
// SpritePolygonTest3();
|
|
|
|
//};
|
|
|
|
//
|
|
|
|
//class SpritePolygonTest4 : public SpritePolygonTestDemo
|
|
|
|
//{
|
|
|
|
//public:
|
|
|
|
// CREATE_FUNC(SpritePolygonTest4);
|
|
|
|
// SpritePolygonTest4();
|
|
|
|
//};
|
2015-04-27 13:34:47 +08:00
|
|
|
|
2015-04-23 18:03:03 +08:00
|
|
|
#endif /* defined(__cocos2d_tests__SpritePolygonTest__) */
|