axmol/tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.h

233 lines
5.4 KiB
C
Raw Normal View History

#ifndef __PERFORMANCE_NODE_CHILDREN_TEST_H__
#define __PERFORMANCE_NODE_CHILDREN_TEST_H__
#include "PerformanceTest.h"
#include "CCProfiling.h"
class NodeChildrenMenuLayer : public PerformBasicLayer
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(NodeChildrenMenuLayer);
2013-11-14 09:36:33 +08:00
NodeChildrenMenuLayer();
NodeChildrenMenuLayer(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0);
virtual void showCurrentTest();
void dumpProfilerInfo(float dt);
// overrides
virtual void onExitTransitionDidStart() override;
virtual void onEnterTransitionDidFinish() override;
};
class NodeChildrenMainScene : public Scene
{
public:
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual std::string title() const;
virtual std::string subtitle() const;
virtual void updateQuantityOfNodes() = 0;
const char* profilerName();
void updateProfilerName();
// for the profiler
virtual const char* testName() = 0;
void updateQuantityLabel();
int getQuantityOfNodes() { return quantityOfNodes; }
protected:
char _profilerName[256];
int lastRenderedCount;
int quantityOfNodes;
int currentQuantityOfNodes;
};
class IterateSpriteSheet : public NodeChildrenMainScene
{
public:
~IterateSpriteSheet();
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
2012-06-08 13:55:28 +08:00
virtual void update(float dt) = 0;
virtual const char* testName();
protected:
SpriteBatchNode *batchNode;
};
class IterateSpriteSheetForLoop : public IterateSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(IterateSpriteSheetForLoop);
2013-11-14 09:36:33 +08:00
IterateSpriteSheetForLoop() {}
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class IterateSpriteSheetIterator : public IterateSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(IterateSpriteSheetIterator);
2013-11-14 09:36:33 +08:00
IterateSpriteSheetIterator() {}
2012-06-08 13:55:28 +08:00
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class IterateSpriteSheetForEach : public IterateSpriteSheet
{
public:
CREATE_FUNC(IterateSpriteSheetForEach);
2013-11-14 07:55:36 +08:00
2012-06-08 13:55:28 +08:00
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class AddRemoveSpriteSheet : public NodeChildrenMainScene
{
public:
~AddRemoveSpriteSheet();
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
2012-06-08 13:55:28 +08:00
virtual void update(float dt) = 0;
virtual const char* testName();
protected:
SpriteBatchNode *batchNode;
#if CC_ENABLE_PROFILERS
ProfilingTimer* _profilingTimer;
#endif
};
///
class CallFuncsSpriteSheetForEach : public IterateSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(CallFuncsSpriteSheetForEach);
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
///
class AddSprite : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(AddSprite);
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class AddSpriteSheet : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(AddSpriteSheet);
2012-06-08 13:55:28 +08:00
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class GetSpriteSheet : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(GetSpriteSheet);
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class RemoveSprite : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RemoveSprite);
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class RemoveSpriteSheet : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(RemoveSpriteSheet);
2012-06-08 13:55:28 +08:00
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class ReorderSpriteSheet : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(ReorderSpriteSheet);
2012-06-08 13:55:28 +08:00
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class SortAllChildrenSpriteSheet : public AddRemoveSpriteSheet
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SortAllChildrenSpriteSheet);
virtual void update(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName();
};
class VisitSceneGraph : public NodeChildrenMainScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(VisitSceneGraph);
void initWithQuantityOfNodes(unsigned int nodes) override;
virtual void update(float dt) override;
void updateQuantityOfNodes() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual const char* testName() override;
};
void runNodeChildrenTest();
#endif // __PERFORMANCE_NODE_CHILDREN_TEST_H__