2012-04-19 14:35:52 +08:00
|
|
|
#ifndef __PERFORMANCE_NODE_CHILDREN_TEST_H__
|
|
|
|
#define __PERFORMANCE_NODE_CHILDREN_TEST_H__
|
|
|
|
|
|
|
|
#include "PerformanceTest.h"
|
2013-10-15 18:00:03 +08:00
|
|
|
#include "CCProfiling.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
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();
|
2012-04-19 14:35:52 +08:00
|
|
|
NodeChildrenMenuLayer(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0);
|
|
|
|
virtual void showCurrentTest();
|
2013-08-21 05:18:32 +08:00
|
|
|
void dumpProfilerInfo(float dt);
|
|
|
|
|
|
|
|
// overrides
|
|
|
|
virtual void onExitTransitionDidStart() override;
|
|
|
|
virtual void onEnterTransitionDidFinish() override;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class NodeChildrenMainScene : public Scene
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const;
|
|
|
|
virtual std::string subtitle() const;
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void updateQuantityOfNodes() = 0;
|
2013-08-29 09:32:45 +08:00
|
|
|
|
|
|
|
const char* profilerName();
|
|
|
|
void updateProfilerName();
|
|
|
|
|
|
|
|
// for the profiler
|
|
|
|
virtual const char* testName() = 0;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
void updateQuantityLabel();
|
|
|
|
|
|
|
|
int getQuantityOfNodes() { return quantityOfNodes; }
|
|
|
|
|
|
|
|
protected:
|
2013-08-29 09:32:45 +08:00
|
|
|
char _profilerName[256];
|
2012-04-19 14:35:52 +08:00
|
|
|
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;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
protected:
|
2013-06-20 14:17:10 +08:00
|
|
|
SpriteBatchNode *batchNode;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-08-21 05:18:32 +08:00
|
|
|
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() {}
|
2013-08-21 05:18:32 +08:00
|
|
|
virtual void update(float dt);
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2013-08-21 05:18:32 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class IterateSpriteSheetIterator : public IterateSpriteSheet
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
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);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-12-19 11:28:09 +08:00
|
|
|
class IterateSpriteSheetForEach : public IterateSpriteSheet
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-12-19 11:28:09 +08:00
|
|
|
CREATE_FUNC(IterateSpriteSheetForEach);
|
2013-11-14 07:55:36 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float dt);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-12-19 11:28:09 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
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;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
protected:
|
2013-06-20 14:17:10 +08:00
|
|
|
SpriteBatchNode *batchNode;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
#if CC_ENABLE_PROFILERS
|
2013-06-20 14:17:10 +08:00
|
|
|
ProfilingTimer* _profilingTimer;
|
2012-04-19 14:35:52 +08:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2013-08-23 09:21:52 +08:00
|
|
|
///
|
|
|
|
|
|
|
|
class CallFuncsSpriteSheetForEach : public IterateSpriteSheet
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(CallFuncsSpriteSheetForEach);
|
|
|
|
|
2013-08-23 09:21:52 +08:00
|
|
|
virtual void update(float dt);
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2013-08-23 09:21:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
///
|
|
|
|
|
2013-09-01 08:08:51 +08:00
|
|
|
class AddSprite : public AddRemoveSpriteSheet
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(AddSprite);
|
|
|
|
|
2013-09-01 08:08:51 +08:00
|
|
|
virtual void update(float dt);
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-09-01 08:08:51 +08:00
|
|
|
virtual const char* testName();
|
|
|
|
};
|
|
|
|
|
2011-03-25 13:59:08 +08:00
|
|
|
class AddSpriteSheet : public AddRemoveSpriteSheet
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
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);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2011-03-25 13:59:08 +08:00
|
|
|
};
|
|
|
|
|
2013-08-25 01:56:07 +08:00
|
|
|
class GetSpriteSheet : public AddRemoveSpriteSheet
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(GetSpriteSheet);
|
|
|
|
|
2013-08-25 01:56:07 +08:00
|
|
|
virtual void update(float dt);
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2013-08-25 01:56:07 +08:00
|
|
|
};
|
|
|
|
|
2013-09-01 08:08:51 +08:00
|
|
|
class RemoveSprite : public AddRemoveSpriteSheet
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(RemoveSprite);
|
|
|
|
|
2013-09-01 08:08:51 +08:00
|
|
|
virtual void update(float dt);
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-09-01 08:08:51 +08:00
|
|
|
virtual const char* testName();
|
|
|
|
};
|
|
|
|
|
2011-03-25 13:59:08 +08:00
|
|
|
class RemoveSpriteSheet : public AddRemoveSpriteSheet
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
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);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2011-03-25 13:59:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ReorderSpriteSheet : public AddRemoveSpriteSheet
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
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);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2011-03-25 13:59:08 +08:00
|
|
|
};
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-24 04:14:57 +08:00
|
|
|
class SortAllChildrenSpriteSheet : public AddRemoveSpriteSheet
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SortAllChildrenSpriteSheet);
|
|
|
|
|
2013-08-24 04:14:57 +08:00
|
|
|
virtual void update(float dt);
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName();
|
2013-08-24 04:14:57 +08:00
|
|
|
};
|
|
|
|
|
2013-08-29 03:39:57 +08:00
|
|
|
class VisitSceneGraph : public NodeChildrenMainScene
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(VisitSceneGraph);
|
|
|
|
|
2013-08-29 03:39:57 +08:00
|
|
|
void initWithQuantityOfNodes(unsigned int nodes) override;
|
|
|
|
|
|
|
|
virtual void update(float dt) override;
|
|
|
|
void updateQuantityOfNodes() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-08-29 09:32:45 +08:00
|
|
|
virtual const char* testName() override;
|
2013-08-29 03:39:57 +08:00
|
|
|
};
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void runNodeChildrenTest();
|
|
|
|
|
|
|
|
#endif // __PERFORMANCE_NODE_CHILDREN_TEST_H__
|