PuzzleSDK
TextureAtlasEncryptionDemo类 参考

#include <TextureAtlasEncryptionTest.h>

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

Public 成员函数

 CREATE_FUNC (TextureAtlasEncryptionDemo)
 
virtual std::string title () const override
 
virtual void onEnter () 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
 

Protected 属性

std::string _title
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

详细描述

在文件 TextureAtlasEncryptionTest.h34 行定义.

成员函数说明

◆ CREATE_FUNC()

TextureAtlasEncryptionDemo::CREATE_FUNC ( TextureAtlasEncryptionDemo  )

◆ onEnter()

void TextureAtlasEncryptionDemo::onEnter ( )
overridevirtual

重载 TestCase .

在文件 TextureAtlasEncryptionTest.cpp40 行定义.

41{
43
44 auto s = Director::getInstance()->getWinSize();
45
46 // Load the non-encrypted atlas
47 SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Images/nonencryptedAtlas.plist", "Images/nonencryptedAtlas.pvr.ccz");
48
49 // Create a sprite from the non-encrypted atlas
50 auto nonencryptedSprite = Sprite::createWithSpriteFrameName("Icon.png");
51 nonencryptedSprite->setPosition(Vec2(s.width * 0.25f, s.height * 0.5f));
52 this->addChild(nonencryptedSprite);
53
54 auto nonencryptedSpriteLabel = Label::createWithTTF("non-encrypted", "fonts/arial.ttf", 28);
55 nonencryptedSpriteLabel->setPosition(Vec2(s.width * 0.25f, nonencryptedSprite->getBoundingBox().getMinY() - nonencryptedSprite->getContentSize().height/2));
56 this->addChild(nonencryptedSpriteLabel, 1);
57
58 // Load the encrypted atlas
59 // 1) Set the encryption keys or step 2 will fail
60 // In this case the encryption key 0xaaaaaaaabbbbbbbbccccccccdddddddd is
61 // split into four parts. See the header docs for more information.
62 ZipUtils::setPvrEncryptionKeyPart(0, 0xaaaaaaaa);
63 ZipUtils::setPvrEncryptionKeyPart(1, 0xbbbbbbbb);
64 ZipUtils::setPvrEncryptionKeyPart(2, 0xcccccccc);
65 ZipUtils::setPvrEncryptionKeyPart(3, 0xdddddddd);
66
67 // Alternatively, you can call the function that accepts the key in a single
68 // function call.
69 // This is slightly less secure because the entire key is more easily
70 // found in the compiled source. See the header docs for more information.
71 // ZipUtils::ccSetPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);
72
73 // 2) Load the encrypted atlas
74 SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Images/encryptedAtlas.plist", "Images/encryptedAtlas.pvr.ccz");
75
76 // 3) Create a sprite from the encrypted atlas
77 auto encryptedSprite = Sprite::createWithSpriteFrameName("powered.png");
78 encryptedSprite->setPosition(Vec2(s.width * 0.75f, s.height * 0.5f));
79 this->addChild(encryptedSprite);
80
81 auto encryptedSpriteLabel = Label::createWithTTF("encrypted", "fonts/arial.ttf", 28);
82 encryptedSpriteLabel->setPosition(Vec2(s.width * 0.75f, encryptedSprite->getBoundingBox().getMinY() - encryptedSpriteLabel->getContentSize().height/2));
83 this->addChild(encryptedSpriteLabel, 1);
84}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ title()

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

重载 TestCase .

在文件 TextureAtlasEncryptionTest.cpp35 行定义.

36{
37 return "Texture Atlas Encryption";
38}

类成员变量说明

◆ _title

std::string TextureAtlasEncryptionDemo::_title
protected

在文件 TextureAtlasEncryptionTest.h43 行定义.


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