Z order

来源:互联网 发布:电脑卡拉ok软件 编辑:程序博客网 时间:2024/04/30 12:38
一、看到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成员变量;

0 0
原创粉丝点击