PuzzleSDK
SpriteChildrenChildren类 参考

#include <SpriteTest.h>

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

Public 成员函数

 CREATE_FUNC (SpriteChildrenChildren)
 
 SpriteChildrenChildren ()
 
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.h607 行定义.

构造及析构函数说明

◆ SpriteChildrenChildren()

SpriteChildrenChildren::SpriteChildrenChildren ( )

在文件 SpriteTest.cpp3171 行定义.

3172{
3173 auto s = Director::getInstance()->getWinSize();
3174
3175 SpriteFrameCache::getInstance()->addSpriteFramesWithFile("animations/ghosts.plist");
3176
3177 Node *aParent;
3178 Sprite *l1, *l2a, *l2b, *l3a1, *l3a2, *l3b1, *l3b2;
3179 auto rot = RotateBy::create(10, 360);
3180 auto seq = RepeatForever::create(rot);
3181
3182 auto rot_back = rot->reverse();
3183 auto rot_back_fe = RepeatForever::create(rot_back);
3184
3185 //
3186 // SpriteBatchNode: 3 levels of children
3187 //
3188
3189 aParent = Node::create();
3190 addChild(aParent);
3191
3192 // parent
3193 l1 = Sprite::createWithSpriteFrameName("father.gif");
3194 l1->setPosition( Vec2( s.width/2, s.height/2) );
3195 l1->runAction( seq->clone() );
3196 aParent->addChild(l1);
3197 auto l1Size = l1->getContentSize();
3198
3199 // child left
3200 l2a = Sprite::createWithSpriteFrameName("sister1.gif");
3201 l2a->setPosition( Vec2( -50 + l1Size.width/2, 0 + l1Size.height/2) );
3202 l2a->runAction( rot_back_fe->clone() );
3203 l1->addChild(l2a);
3204 auto l2aSize = l2a->getContentSize();
3205
3206
3207 // child right
3208 l2b = Sprite::createWithSpriteFrameName("sister2.gif");
3209 l2b->setPosition( Vec2( +50 + l1Size.width/2, 0 + l1Size.height/2) );
3210 l2b->runAction( rot_back_fe->clone() );
3211 l1->addChild(l2b);
3212 auto l2bSize = l2a->getContentSize();
3213
3214
3215 // child left bottom
3216 l3a1 = Sprite::createWithSpriteFrameName("child1.gif");
3217 l3a1->setScale( 0.45f );
3218 l3a1->setPosition( Vec2(0+l2aSize.width/2,-100+l2aSize.height/2) );
3219 l2a->addChild(l3a1);
3220
3221 // child left top
3222 l3a2 = Sprite::createWithSpriteFrameName("child1.gif");
3223 l3a2->setScale( 0.45f );
3224 l3a1->setPosition( Vec2(0+l2aSize.width/2,+100+l2aSize.height/2) );
3225 l2a->addChild(l3a2);
3226
3227 // child right bottom
3228 l3b1 = Sprite::createWithSpriteFrameName("child1.gif");
3229 l3b1->setScale( 0.45f);
3230 l3b1->setFlippedY( true );
3231 l3b1->setPosition( Vec2(0+l2bSize.width/2,-100+l2bSize.height/2) );
3232 l2b->addChild(l3b1);
3233
3234 // child right top
3235 l3b2 = Sprite::createWithSpriteFrameName("child1.gif");
3236 l3b2->setScale( 0.45f );
3237 l3b2->setFlippedY( true );
3238 l3b1->setPosition( Vec2(0+l2bSize.width/2,+100+l2bSize.height/2) );
3239 l2b->addChild(l3b2);
3240}

成员函数说明

◆ CREATE_FUNC()

SpriteChildrenChildren::CREATE_FUNC ( SpriteChildrenChildren  )

◆ subtitle()

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

重载 TestCase .

在文件 SpriteTest.cpp3247 行定义.

3248{
3249 return "multiple levels of children";
3250}

◆ title()

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

重载 TestCase .

在文件 SpriteTest.cpp3242 行定义.

3243{
3244 return "Testing Sprite";
3245}

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