PuzzleSDK
SpriteSlice9Test4类 参考

#include <SpriteTest.h>

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

Public 成员函数

 CREATE_FUNC (SpriteSlice9Test4)
 
 SpriteSlice9Test4 ()
 
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
 

额外继承的成员函数

- 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.h833 行定义.

构造及析构函数说明

◆ SpriteSlice9Test4()

SpriteSlice9Test4::SpriteSlice9Test4 ( )

在文件 SpriteTest.cpp5309 行定义.

5310{
5311 Size s = Director::getInstance()->getWinSize();
5312
5313
5314 for (int i=2; i>0; --i)
5315 {
5316 //Create reference sprite that's rotating based on there anchor point
5317 auto s1 = Sprite::create("ccs-res/cocosui/button.png");
5318 addChild(s1);
5319 s1->setPosition(s.width*1/4, s.height*i/3);
5320 s1->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
5321 s1->setContentSize(s1->getContentSize() * 2);
5322 auto action1 = RepeatForever::create(RotateBy::create(5.0f, 360.0f));
5323 s1->runAction(action1);
5324
5325 //Create reference sprite that's rotating based on there anchor point
5326 auto s2 = Sprite::create("ccs-res/cocosui/button.png");
5327 addChild(s2);
5328 s2->setPosition(s.width*2/4, s.height*i/3);
5329 s2->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
5330 s2->setContentSize(s2->getContentSize() * 3);
5331 auto action2 = RepeatForever::create(RotateBy::create(5.0f, 360.0f));
5332 s2->runAction(action2);
5333
5334 //Create reference sprite that's rotating based on there anchor point
5335 auto s3 = Sprite::create("ccs-res/cocosui/button.png");
5336 addChild(s3);
5337 s3->setPosition(s.width*3/4, s.height*i/3);
5338 s3->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
5339 s3->setContentSize(s3->getContentSize() * 4);
5340 auto action3 = RepeatForever::create(RotateBy::create(5.0f, 360.0f));
5341 s3->runAction(action3);
5342
5343 // enable slice 9, only in the first row
5344 if (i==2) {
5345 s1->setCenterRect(CC_RECT_PIXELS_TO_POINTS(Rect(6, 14, 2, 4)));
5346 s2->setCenterRect(CC_RECT_PIXELS_TO_POINTS(Rect(6, 14, 2, 4)));
5347 s3->setCenterRect(CC_RECT_PIXELS_TO_POINTS(Rect(6, 14, 2, 4)));
5348 }
5349
5350 // "anchor points"
5351 auto point = Sprite::create("Images/r1.png");
5352 point->setScale(0.1f);
5353 point->setPosition( s1->getPosition() );
5354 addChild(point, 10);
5355
5356 auto point2 = Sprite::create("Images/r1.png");
5357 point2->setScale(0.1f);
5358 point2->setPosition(s2->getPosition());
5359 addChild(point2, 10);
5360
5361 auto point3 = Sprite::create("Images/r1.png");
5362 point3->setScale(0.1f);
5363 point3->setPosition(s3->getPosition());
5364 addChild(point3, 10);
5365 }
5366}

成员函数说明

◆ CREATE_FUNC()

SpriteSlice9Test4::CREATE_FUNC ( SpriteSlice9Test4  )

◆ subtitle()

virtual std::string SpriteSlice9Test4::subtitle ( ) const
inlineoverridevirtual

重载 TestCase .

在文件 SpriteTest.h839 行定义.

839{ return "Testing scaling a button"; }

◆ title()

virtual std::string SpriteSlice9Test4::title ( ) const
inlineoverridevirtual

重载 TestCase .

在文件 SpriteTest.h838 行定义.

838{ return "Slice 9 Test #4"; };

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