PuzzleSDK
LabelFNTSpriteActions类 参考

#include <LabelTestNew.h>

+ 类 LabelFNTSpriteActions 继承关系图:
+ LabelFNTSpriteActions 的协作图:

Public 成员函数

 CREATE_FUNC (LabelFNTSpriteActions)
 
 LabelFNTSpriteActions ()
 
virtual void step (float dt)
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 
virtual void onEnter () override
 

Private 属性

float _time
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 LabelTestNew.h54 行定义.

构造及析构函数说明

◆ LabelFNTSpriteActions()

LabelFNTSpriteActions::LabelFNTSpriteActions ( )

在文件 LabelTestNew.cpp209 行定义.

210{
211 _time = 0;
212
213 auto s = Director::getInstance()->getWinSize();
214
215 auto drawNode = DrawNode::create();
216 drawNode->drawLine( Vec2(0.0f, s.height/2), Vec2(s.width, s.height/2), Color4F(1.0f, 1.0f, 1.0f, 1.0f) );
217 drawNode->drawLine( Vec2(s.width/2, 0.0f), Vec2(s.width/2, s.height), Color4F(1.0f, 1.0f, 1.0f, 1.0f) );
218 addChild(drawNode, -1);
219
220 // Upper Label
221 auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Bitmap Font Atlas");
222 addChild(label);
223
224
225 label->setPosition( Vec2(s.width/2, s.height/2) );
226
227 auto BChar = (Sprite*) label->getLetter(0);
228 auto FChar = (Sprite*) label->getLetter(7);
229 auto AChar = (Sprite*) label->getLetter(12);
230
231
232 auto rotate = RotateBy::create(2, 360);
233 auto rot_4ever = RepeatForever::create(rotate);
234
235 auto scale = ScaleBy::create(2, 1.5f);
236 auto scale_back = scale->reverse();
237 auto scale_seq = Sequence::create(scale, scale_back,nullptr);
238 auto scale_4ever = RepeatForever::create(scale_seq);
239
240 auto jump = JumpBy::create(0.5f, Vec2::ZERO, 60, 1);
241 auto jump_4ever = RepeatForever::create(jump);
242
243 auto fade_out = FadeOut::create(1);
244 auto fade_in = FadeIn::create(1);
245 auto seq = Sequence::create(fade_out, fade_in, nullptr);
246 auto fade_4ever = RepeatForever::create(seq);
247
248 BChar->runAction(rot_4ever);
249 BChar->runAction(scale_4ever);
250 FChar->runAction(jump_4ever);
251 AChar->runAction(fade_4ever);
252
253
254 // Bottom Label
255 auto label2 = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "00.0");
256 addChild(label2, 0, kTagBitmapAtlas2);
257 label2->setPosition( Vec2(s.width/2.0f, 80.0f) );
258
259 auto lastChar = (Sprite*) label2->getLetter(3);
260 lastChar->runAction( rot_4ever->clone() );
261
262 schedule(CC_CALLBACK_1(LabelFNTSpriteActions::step, this), 0.1f, "step_key");
263}
@ kTagBitmapAtlas2
virtual void step(float dt)

引用了 _time, kTagBitmapAtlas2 , 以及 step().

+ 函数调用图:

成员函数说明

◆ CREATE_FUNC()

LabelFNTSpriteActions::CREATE_FUNC ( LabelFNTSpriteActions  )

◆ step()

void LabelFNTSpriteActions::step ( float  dt)
virtual

在文件 LabelTestNew.cpp265 行定义.

266{
267 _time += dt;
268 char string[10] = {0};
269 sprintf(string, "%04.1f", _time);
270 auto label1 = (Label*) getChildByTag(kTagBitmapAtlas2);
271 label1->setString(string);
272}

引用了 _time , 以及 kTagBitmapAtlas2.

被这些函数引用 LabelFNTSpriteActions().

+ 这是这个函数的调用关系图:

◆ subtitle()

std::string LabelFNTSpriteActions::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 LabelTestNew.cpp279 行定义.

280{
281 return "Testing run action on the specified character";
282}

◆ title()

std::string LabelFNTSpriteActions::title ( ) const
overridevirtual

重载 TestCase .

在文件 LabelTestNew.cpp274 行定义.

275{
276 return "New Label + Bitmap font";
277}

类成员变量说明

◆ _time

float LabelFNTSpriteActions::_time
private

在文件 LabelTestNew.h56 行定义.

被这些函数引用 LabelFNTSpriteActions() , 以及 step().


该类的文档由以下文件生成: