PuzzleSDK
SpriteBatchNodeReorder类 参考

#include <SpriteTest.h>

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

Public 成员函数

 CREATE_FUNC (SpriteBatchNodeReorder)
 
 SpriteBatchNodeReorder ()
 
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.h131 行定义.

构造及析构函数说明

◆ SpriteBatchNodeReorder()

SpriteBatchNodeReorder::SpriteBatchNodeReorder ( )

在文件 SpriteTest.cpp679 行定义.

680{
681 Vector<Sprite*> a;
682 auto asmtest = SpriteBatchNode::create("animations/ghosts.png");
683
684 for(int i=0; i<10; i++)
685 {
686 auto s1 = Sprite::createWithTexture(asmtest->getTexture(), Rect(0.0f, 0.0f, 50.0f, 50.0f));
687 a.pushBack(s1);
688 asmtest->addChild(s1, 10);
689 }
690
691 for(int i=0; i<10; i++)
692 {
693 if(i!=5)
694 {
695 asmtest->reorderChild( static_cast<Node*>(a.at(i)), 9 );
696 }
697 }
698
699 ssize_t CC_UNUSED prev = -1;
700
701 auto& children = asmtest->getChildren();
702
703 for(const auto &obj : children) {
704 auto child = static_cast<Sprite*>(obj);
705
706 ssize_t currentIndex = child->getAtlasIndex();
707 CCASSERT( prev == currentIndex-1, "Child order failed");
709 prev = currentIndex;
710 }
711
712 prev = -1;
713 auto& descendants = asmtest->getDescendants();
714 for(const auto &sprite : descendants) {
715 ssize_t currentIndex = sprite->getAtlasIndex();
716 CCASSERT( prev == currentIndex-1, "Child order failed");
718 prev = currentIndex;
719 }
720}

成员函数说明

◆ CREATE_FUNC()

SpriteBatchNodeReorder::CREATE_FUNC ( SpriteBatchNodeReorder  )

◆ subtitle()

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

重载 TestCase .

在文件 SpriteTest.cpp727 行定义.

728{
729 return "reorder #1. Should not crash";
730}

◆ title()

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

重载 TestCase .

在文件 SpriteTest.cpp722 行定义.

723{
724 return "Testing SpriteBatchNode";
725}

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