PuzzleSDK
Sprite6类 参考

#include <SpriteTest.h>

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

Public 成员函数

 CREATE_FUNC (Sprite6)
 
 Sprite6 ()
 
virtual std::string title () const override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string subtitle () const
 
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
 

额外继承的成员函数

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

详细描述

在文件 SpriteTest.h243 行定义.

构造及析构函数说明

◆ Sprite6()

Sprite6::Sprite6 ( )

在文件 SpriteTest.cpp1277 行定义.

1278{
1279 // small capacity. Testing resizing
1280 // Don't use capacity=1 in your real game. It is expensive to resize the capacity
1281 auto batch = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 1);
1282 addChild(batch, 0, kTagSpriteBatchNode);
1283 batch->setIgnoreAnchorPointForPosition( true );
1284
1285 auto s = Director::getInstance()->getWinSize();
1286
1287 batch->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
1288 batch->setContentSize( Size(s.width, s.height) );
1289
1290
1291 // SpriteBatchNode actions
1292 auto rotate = RotateBy::create(5, 360);
1293 auto action = RepeatForever::create(rotate);
1294
1295 // SpriteBatchNode actions
1296 auto rotate_back = rotate->reverse();
1297 auto rotate_seq = Sequence::create(rotate, rotate_back, nullptr);
1298 auto rotate_forever = RepeatForever::create(rotate_seq);
1299
1300 auto scale = ScaleBy::create(5, 1.5f);
1301 auto scale_back = scale->reverse();
1302 auto scale_seq = Sequence::create( scale, scale_back, nullptr);
1303 auto scale_forever = RepeatForever::create(scale_seq);
1304
1305 float step = s.width/4;
1306
1307 for(int i=0;i<3;i++)
1308 {
1309 auto sprite = Sprite::createWithTexture(batch->getTexture(), Rect(85*i, 121*1, 85, 121));
1310 sprite->setPosition( Vec2( (i+1)*step, s.height/2) );
1311
1312 sprite->runAction( action->clone());
1313 batch->addChild(sprite, i);
1314 }
1315
1316 batch->runAction(scale_forever);
1317 batch->runAction(rotate_forever);
1318}
@ kTagSpriteBatchNode
Definition: SpriteTest.cpp:40

引用了 kTagSpriteBatchNode.

成员函数说明

◆ CREATE_FUNC()

Sprite6::CREATE_FUNC ( Sprite6  )

◆ title()

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

重载 TestCase .

在文件 SpriteTest.cpp1320 行定义.

1321{
1322 return "SpriteBatchNode transformation";
1323}

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