cocos2dx 3.3 setGlobalZOrder对label没有作用
发布时间:2020-12-14 19:35:57 所属栏目:百科 来源:网络整理
导读:/** Defines the oder in which the nodes are renderer. Nodes that have a Global Z Order lower,are renderer first. In case two or more nodes have the same Global Z Order,the oder is not guaranteed. The only exception if the Nodes have a Glob
/** Defines the oder in which the nodes are renderer. Nodes that have a Global Z Order lower,are renderer first. In case two or more nodes have the same Global Z Order,the oder is not guaranteed. The only exception if the Nodes have a Global Z Order == 0. In that case,the Scene Graph order is used. By default,all nodes have a Global Z Order = 0. That means that by default,the Scene Graph order is used to render the nodes. Global Z Order is useful when you need to render nodes in an order different than the Scene Graph order. Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their acenstors. And if ClippingNode is one of the ancestors,then "global Z order" will be relative to the ClippingNode. @see `setLocalZOrder()` @see `setVertexZ()` @since v3.0 */ virtual void setGlobalZOrder(float globalZOrder); 今天写代码,准备在最上层加一个label来显示分数,因为之前为了省事儿给好多node设置了GlobalZOrder,可是新添加的这个label一直被上层的node给挡住。 上网查了查才知道: "Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their censors."
class CC_DLL Label : public SpriteBatchNode,public LabelProtocol Label是继承了SpriteBatchNode,所以Label设置setGlobalZOrder无效。也没想到解决办法,还是去掉用的setGlobalZOrder吧。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |