PuzzleSDK
SpriteBatchNodeZVertex类 参考

#include <SpriteTest.h>

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

Public 成员函数

 CREATE_FUNC (SpriteBatchNodeZVertex)
 
virtual void onEnter () override
 
virtual void onExit () override
 
 SpriteBatchNodeZVertex ()
 
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
 

Protected 属性

int _dir
 
float _time
 
- Protected 属性 继承自 SpriteTestDemo
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
 

详细描述

在文件 SpriteTest.h196 行定义.

构造及析构函数说明

◆ SpriteBatchNodeZVertex()

SpriteBatchNodeZVertex::SpriteBatchNodeZVertex ( )

在文件 SpriteTest.cpp1031 行定义.

1032{
1033 //
1034 // This test tests z-order
1035 // If you are going to use it is better to use a 3D projection
1036 //
1037 // WARNING:
1038 // The developer is responsible for ordering its sprites according to its Z if the sprite has
1039 // transparent parts.
1040 //
1041
1042 //
1043 // Configure shader to mimic glAlphaTest
1044 //
1045// auto alphaTestShader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
1046// GLint alphaValueLocation = glGetUniformLocation(alphaTestShader->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
1047
1048 // set alpha test value
1049 // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison
1050// if (getGLProgram())
1051// {
1052// getGLProgram()->setUniformLocationWith1f(alphaValueLocation, 0.0f);
1053// }
1054
1055 auto s = Director::getInstance()->getWinSize();
1056 float step = s.width/12;
1057
1058 // small capacity. Testing resizing.
1059 // Don't use capacity=1 in your real game. It is expensive to resize the capacity
1060 auto batch = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 1);
1061 // camera uses the center of the image as the pivoting point
1062 batch->setContentSize( Size(s.width,s.height));
1063 batch->setAnchorPoint( Vec2::ANCHOR_MIDDLE);
1064 batch->setPosition( Vec2(s.width/2, s.height/2));
1065
1066// batch->setGLProgram(alphaTestShader);
1067 addChild(batch, 0, kTagSpriteBatchNode);
1068
1069 for(int i=0;i<5;i++)
1070 {
1071 auto sprite = Sprite::createWithTexture(batch->getTexture(), Rect(85*0, 121*1, 85, 121));
1072 sprite->setPosition( Vec2( (i+1)*step, s.height/2) );
1073 sprite->setPositionZ( 10 + i*40 );
1074 batch->addChild(sprite, 0);
1075
1076 }
1077
1078 for(int i=5;i<11;i++) {
1079 auto sprite = Sprite::createWithTexture(batch->getTexture(), Rect(85*1, 121*0, 85, 121));
1080 sprite->setPosition( Vec2( (i+1)*step, s.height/2) );
1081 sprite->setPositionZ( 10 + (10-i)*40 );
1082 batch->addChild(sprite, 0);
1083 }
1084
1085 batch->runAction(OrbitCamera::create(10, 1, 0, 0, 360, 0, 0) );
1086}
@ kTagSpriteBatchNode
Definition: SpriteTest.cpp:40

引用了 kTagSpriteBatchNode.

成员函数说明

◆ CREATE_FUNC()

SpriteBatchNodeZVertex::CREATE_FUNC ( SpriteBatchNodeZVertex  )

◆ onEnter()

void SpriteBatchNodeZVertex::onEnter ( )
overridevirtual

重载 TestCase .

在文件 SpriteTest.cpp1018 行定义.

1019{
1021
1022 Director::getInstance()->setProjection(Director::Projection::_3D);
1023}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ onExit()

void SpriteBatchNodeZVertex::onExit ( )
overridevirtual

在文件 SpriteTest.cpp1025 行定义.

1026{
1027 Director::getInstance()->setProjection(Director::Projection::DEFAULT);
1028 SpriteTestDemo::onExit();
1029}

◆ subtitle()

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

重载 TestCase .

在文件 SpriteTest.cpp1093 行定义.

1094{
1095 return "openGL Z vertex";
1096}

◆ title()

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

重载 TestCase .

在文件 SpriteTest.cpp1088 行定义.

1089{
1090 return "Testing SpriteBatchNode";
1091}

类成员变量说明

◆ _dir

int SpriteBatchNodeZVertex::_dir
protected

在文件 SpriteTest.h208 行定义.

◆ _time

float SpriteBatchNodeZVertex::_time
protected

在文件 SpriteTest.h209 行定义.


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