axmol/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h

130 lines
3.0 KiB
C
Raw Normal View History

2015-04-23 18:03:03 +08:00
#ifndef __cocos2d_tests__SpritePolygonTest__
2015-06-06 13:31:25 +08:00
2015-04-23 18:03:03 +08:00
#include "../BaseTest.h"
2015-06-04 15:43:31 +08:00
#include "ui/CocosGUI.h"
2015-06-06 13:31:25 +08:00
DEFINE_TEST_SUITE(SpritePolygonTest);
2015-06-04 15:43:31 +08:00
class SpritePolygonTestCase : public TestCase
2015-04-23 18:03:03 +08:00
{
protected:
2015-07-15 12:04:48 +08:00
virtual void onBackCallback(Ref* sender)override;
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
};
class SpritePolygonTestDemo : public SpritePolygonTestCase
{
protected:
2015-06-04 15:43:31 +08:00
void initTouchDebugDraw();
cocos2d::Sprite* spp;
cocos2d::Sprite* sp;
};
2015-06-04 15:43:31 +08:00
class SpritePolygonTest1 : public SpritePolygonTestDemo
{
public:
CREATE_FUNC(SpritePolygonTest1);
SpritePolygonTest1();
void make2Sprites();
};
class SpritePolygonTest2 : public SpritePolygonTestDemo
{
public:
CREATE_FUNC(SpritePolygonTest2);
SpritePolygonTest2();
void make2Sprites();
};
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;
2015-06-04 15:43:31 +08:00
int _posX;
int _posY;
int _leftX;
int _rightX;
bool goRight;
bool ended;
float prevDt;
virtual Node* makeSprite();
virtual void incrementStats();
void initIncrementStats();
unsigned int _incVert;
unsigned int _incTri;
unsigned int _incPix;
};
2015-06-04 15:43:31 +08:00
class SpritePolygonPerformanceTestDynamic : public SpritePolygonPerformance
{
public:
2015-06-04 15:43:31 +08:00
CREATE_FUNC(SpritePolygonPerformanceTestDynamic);
SpritePolygonPerformanceTestDynamic();
protected:
2015-06-04 15:43:31 +08:00
cocos2d::Sprite* makeSprite();
cocos2d::PolygonInfo _pinfo;
void initIncrementStats();
};
2015-06-04 15:43:31 +08:00
class SpritePerformanceTestDynamic : public SpritePolygonPerformance
{
public:
2015-06-04 15:43:31 +08:00
CREATE_FUNC(SpritePerformanceTestDynamic);
SpritePerformanceTestDynamic();
protected:
cocos2d::Sprite* makeSprite();
void initIncrementStats();
};
2015-06-04 15:43:31 +08:00
class SpritePolygonTestSlider : public SpritePolygonTestCase
{
public:
2015-06-04 15:43:31 +08:00
CREATE_FUNC(SpritePolygonTestSlider);
SpritePolygonTestSlider();
protected:
2015-06-08 15:08:16 +08:00
cocos2d::Label *_epsilonLabel;
2015-06-04 15:43:31 +08:00
cocos2d::Sprite* makeSprite(const std::string& filename, const cocos2d::Vec2& pos);
void makeSprites(const std::string* list, const int count, const float y);
cocos2d::TTFConfig _ttfConfig;
void changeEpsilon(Ref *pSender, cocos2d::ui::Slider::EventType type);
void updateLabel(const cocos2d::Sprite* sp, const cocos2d::PolygonInfo &pinfo);
};
2015-06-04 15:43:31 +08:00
class SpritePolygonTest3 : public SpritePolygonTestSlider
{
public:
2015-06-04 15:43:31 +08:00
CREATE_FUNC(SpritePolygonTest3);
SpritePolygonTest3();
};
2015-06-04 15:43:31 +08:00
class SpritePolygonTest4 : public SpritePolygonTestSlider
{
public:
CREATE_FUNC(SpritePolygonTest4);
SpritePolygonTest4();
};
2015-06-04 15:43:31 +08:00
2015-04-23 18:03:03 +08:00
#endif /* defined(__cocos2d_tests__SpritePolygonTest__) */