I want to avoid manually assigning random Z values for Layers/Nodes in Cocos2D and planning on using enums for it.
I know enums are ordinal-ordered but is it safe to rely on the enum ordering in Obj-C/Cocos2D?
For eg, is it safe to do something like
enum {
kZValMIN,
kZValLayer1,
kZValLayer2,
……..
kZValLayerN,
kZValMAX
}
when I want LayerN top-most and Layer1 at the bottom?
Yes.
In addition you can assign specific values and the enumeration of following objects continue from that value:
kZValMAX would then be 101.