加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Z order

发布时间:2020-12-14 19:05:49 所属栏目:百科 来源:网络整理
导读:一、看到cocos2d中有一段对Z order的介绍/** * Sets the Z order which stands for the drawing order,and reorder this node in its parent's children array. * * The Z order of node is relative to its "brothers": children of the same parent. * It's
一、看到cocos2d中有一段对Z order的介绍/**
* Sets the Z order which stands for the drawing order,and reorder this node in its parent's children array.
*
* The Z order of node is relative to its "brothers": children of the same parent.
* It's nothing to do with OpenGL's z vertex. This one only affects the draw order of nodes in cocos2d.
* The larger number it is,the later this node will be drawn in each message loop.
* Please refer to setVertexZ(float) for the difference.
*
* @param nZOrder Z order of this node.

*/

Z order用于表示node节点被描绘的顺序和记录它在父节点中的子节点数组中的位置。

node节点的Z order只是和当前的父节点的所有子节点的进行比较和起作用,具有局部性。

Z order跟OperGL的顶点无关,它只是cocos2d的节点的画图特性;

Z order越大,则表示节点在消息循环中被描绘的顺序越靠后;

可以使用setVertexZ对节点的Z order进行设置,node的nZOrder代表了node的Z order值;


二、setZOrder和_setZOrder之间的区别:_setZOrder仅仅是设置m_nZOrder的成员变量值;setZOrder先是首先设置m_nZOrder的值,然后记录该节点在父节点的子节点数组终端的位置---m_uOrderOfArrival成员变量;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读