PuzzleSDK
NewRendererTest.h
浏览该文件的文档.
1/****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos2d-x.org
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23 ****************************************************************************/
24
25#ifndef __NewRendererTest_H_
26#define __NewRendererTest_H_
27
28#include "cocos2d.h"
29#include "../BaseTest.h"
30
31#define kTagSpriteBatchNode 100
32#define kTagClipperNode 101
33#define kTagContentNode 102
34
35DEFINE_TEST_SUITE(NewRendererTests);
36
38{
39public:
40 virtual std::string title() const override;
41 virtual std::string subtitle() const override;
42
43protected:
44
45};
46
48{
49public:
51
52 virtual std::string title() const override;
53 virtual std::string subtitle() const override;
54
55 void createSpriteTest();
57 void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
58
59protected:
61 virtual ~NewSpriteTest();
62};
63
65{
66public:
68
69 virtual std::string title() const override;
70 virtual std::string subtitle() const override;
71
72protected:
74 virtual ~GroupCommandTest();
75};
76
78{
79public:
80
82 virtual std::string title() const override;
83 virtual std::string subtitle() const override;
84
85 void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
86 void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
87 void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
88
89protected:
91 virtual ~NewClippingNodeTest();
92
94 cocos2d::Vec2 _lastPoint;
95};
96
98{
99public:
100
101 CREATE_FUNC(NewDrawNodeTest)
102 virtual std::string title() const override;
103 virtual std::string subtitle() const override;
104
105protected:
107 virtual ~NewDrawNodeTest();
108};
109
111{
112public:
113
114 CREATE_FUNC(NewCullingTest)
115 virtual std::string title() const override;
116 virtual std::string subtitle() const override;
117
118protected:
120 virtual ~NewCullingTest();
121 bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event *event);
122 void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event *event);
123 cocos2d::Vec2 _lastPos;
124};
125
127{
128public:
130 virtual std::string title() const override;
131 virtual std::string subtitle() const override;
132
133 void addSpritesCallback(Ref *);
134 void delSpritesCallback(Ref *);
135
136 void updateSpriteCountLabel(int x);
137
138 void doTest();
139
140protected:
141 int totalSprites = 1000;
142 int suggestDelta = 100;
143 cocos2d::Label* _labelSpriteNum = nullptr;
144 cocos2d::Label* labelCreate = nullptr;
145 cocos2d::Label* labelDestory = nullptr;
147 virtual ~SpriteCreation();
148};
149
150
152{
153public:
155 virtual std::string title() const override;
156 virtual std::string subtitle() const override;
157
158protected:
159 VBOFullTest();
160 virtual ~VBOFullTest();
161};
162
163
165{
166 static const int childTag = 119;
167public:
169 virtual std::string title() const override;
170 virtual std::string subtitle() const override;
171
172protected:
175
176 void onCaptured(cocos2d::Ref*);
177 void afterCaptured(bool succeed, const std::string& outputFile);
178
179 std::string _filename;
180};
181
183{
184 static const int childTag = 120;
185public:
187 virtual std::string title() const override;
188 virtual std::string subtitle() const override;
189
190protected:
193
194 void onCaptured(cocos2d::Ref*);
195
196 std::string _filename;
197};
198
200{
201public:
203 virtual std::string title() const override;
204 virtual std::string subtitle() const override;
205protected:
207};
208
210{
211public:
213 virtual std::string title() const override;
214 virtual std::string subtitle() const override;
215protected:
217};
218
219
221{
222public:
224 virtual std::string title() const override;
225 virtual std::string subtitle() const override;
226protected:
228
229 cocos2d::backend::ProgramState* createBlurProgramState();
230 cocos2d::backend::ProgramState* createSepiaProgramState();
231};
232
234{
235public:
237 virtual std::string title() const override;
238 virtual std::string subtitle() const override;
239protected:
241
242 cocos2d::backend::ProgramState* createBlurProgramState();
243 cocos2d::backend::ProgramState* createSepiaProgramState();
244};
245
247{
248public:
250 virtual std::string title() const override;
251 virtual std::string subtitle() const override;
252
253 virtual void update(float dt) override;
254protected:
256
257 void createSprite();
258
259 virtual ~NonBatchSprites();
260 class Ticker {
261 public:
262 Ticker(int m):_max(m) {}
263 void hit() {_cnt += 1;}
264 void cancel() {_cnt = 0;}
265 bool ok() {return _cnt >= _max;}
266 private:
267 int _cnt = 0;
268 int _max = 0;
269 };
270 Node *_spritesAnchor = nullptr;
272 float _maDt = 1.0f / 60.0f;
273 float _rmaDt = 1.0f/ 60.0f;
274 const float DEST_DT_30FPS = 1.0f / 30.0f;
275 cocos2d::Label * _totalSprites = nullptr;
279};
280#endif //__NewRendererTest_H_
DEFINE_TEST_SUITE(NewRendererTests)
virtual std::string title() const override
virtual std::string subtitle() const override
CREATE_FUNC(BugAutoCulling)
static const int childTag
virtual std::string subtitle() const override
std::string _filename
virtual std::string title() const override
void onCaptured(cocos2d::Ref *)
CREATE_FUNC(CaptureNodeTest)
void afterCaptured(bool succeed, const std::string &outputFile)
static const int childTag
void onCaptured(cocos2d::Ref *)
CREATE_FUNC(CaptureScreenTest)
virtual std::string title() const override
std::string _filename
virtual std::string subtitle() const override
CREATE_FUNC(GroupCommandTest)
virtual std::string title() const override
virtual ~GroupCommandTest()
virtual std::string subtitle() const override
virtual std::string subtitle() const override
virtual std::string title() const override
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
virtual std::string subtitle() const override
void onTouchesBegan(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
CREATE_FUNC(NewClippingNodeTest)
cocos2d::Vec2 _lastPoint
virtual std::string title() const override
cocos2d::Vec2 _lastPos
virtual std::string title() const override
void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event)
virtual std::string subtitle() const override
virtual ~NewCullingTest()
bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event)
virtual ~NewDrawNodeTest()
virtual std::string subtitle() const override
virtual std::string title() const override
virtual std::string subtitle() const override
virtual std::string title() const override
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
void createNewSpriteTest()
virtual ~NewSpriteTest()
CREATE_FUNC(NewSpriteTest)
virtual void update(float dt) override
CREATE_FUNC(NonBatchSprites)
virtual std::string title() const override
virtual ~NonBatchSprites()
virtual std::string subtitle() const override
const float DEST_DT_30FPS
cocos2d::Label * _totalSprites
virtual std::string title() const override
virtual std::string subtitle() const override
CREATE_FUNC(RendererBatchQuadTri)
CREATE_FUNC(RendererUniformBatch2)
virtual std::string title() const override
cocos2d::backend::ProgramState * createSepiaProgramState()
virtual std::string subtitle() const override
cocos2d::backend::ProgramState * createBlurProgramState()
virtual std::string title() const override
virtual std::string subtitle() const override
cocos2d::backend::ProgramState * createSepiaProgramState()
cocos2d::backend::ProgramState * createBlurProgramState()
CREATE_FUNC(RendererUniformBatch)
virtual std::string title() const override
void addSpritesCallback(Ref *)
void delSpritesCallback(Ref *)
CREATE_FUNC(SpriteCreation)
void updateSpriteCountLabel(int x)
cocos2d::Label * _labelSpriteNum
virtual std::string subtitle() const override
cocos2d::Label * labelCreate
virtual ~SpriteCreation()
cocos2d::Label * labelDestory
CREATE_FUNC(VBOFullTest)
virtual std::string subtitle() const override
virtual std::string title() const override
virtual ~VBOFullTest()