PuzzleSDK
TexturePNG类 参考

#include <Texture2dTest.h>

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

Public 成员函数

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

额外继承的成员函数

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

详细描述

在文件 Texture2dTest.h50 行定义.

成员函数说明

◆ CREATE_FUNC()

TexturePNG::CREATE_FUNC ( TexturePNG  )

◆ onEnter()

void TexturePNG::onEnter ( )
overridevirtual

重载 TextureDemo .

在文件 Texture2dTest.cpp162 行定义.

163{
165
166 auto s = Director::getInstance()->getWinSize();
167
168 auto img = Sprite::create("Images/test_image.png");
169 img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
170 addChild(img);
171 log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
172
173 // Test PNG files with different pixel formats
174 // grayscale without alpha
175 auto i8 = Sprite::create("Images/test_image_i8.png");
176 i8->setPosition(s.width/4.0f, s.height/4.0f);
177 addChild(i8);
178
179 // grayscale with alpha
180 auto ai88 = Sprite::create("Images/test_image_ai88.png");
181 ai88->setPosition(s.width / 4.0f, s.height * 3.0f / 4.0f);
182 addChild(ai88);
183
184 // rgb without alpha
185 auto rgb888 = Sprite::create("Images/test_image_rgb888.png");
186 rgb888->setPosition(s.width * 3.0f / 4.0f, s.height / 4.0f);
187 addChild(rgb888);
188
189 // rgba with alpha
190 auto rgba8888 = Sprite::create("Images/test_image_rgba8888.png");
191 rgba8888->setPosition(s.width * 3.0f / 4.0f, s.height * 3.0f / 4.0f);
192 addChild(rgba8888);
193}
virtual void onEnter() override

引用了 TextureDemo::onEnter().

+ 函数调用图:

◆ subtitle()

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

重载 TestCase .

在文件 Texture2dTest.cpp200 行定义.

201{
202 return "LB:I8, LT:AI8\nRB:RGB888, RT: RGBA8888";
203}

◆ title()

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

重载 TestCase .

在文件 Texture2dTest.cpp195 行定义.

196{
197 return "PNG Test";
198}

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