微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Z order

一、看到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成员变量;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐