Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Sprite rendering order / render index / Z-order within parent — Gideros Forum

Sprite rendering order / render index / Z-order within parent

kussakovkussakov Member
edited October 2013 in Suggestions & requests
Hi,

How hard it is to add the following feature for sprites:
Setting the rendering index (A.K.A "Z-order").

As of now Gideros renders the child sprites of a sprite by the order they were added.
So how hard it is to add a new API or property of the Sprite class called say: setZorder(default Z order=0)?

This way the order the children are rendered will be: Z asc, Index asc.
Or something like e.g. Z*10000+index asc

As of now the order is only by index.

The other option is to add setChildIndex (there is already getChildIndex and addChildAt), but this is harder to use because the indexes are sequential and represent a lua array(I am guessing)...

This will be very helpful if you want to organize the app layers and objects easily. It will also be helpful when you dynamically add objects to the scene and do not want them to appear on top of everything.

Cocos2d and other such frameworks have this feature and I use it all the time. I guess this is some OpenGL property, but I am not OpenGL expert. If it is - this is as simple as setting this property to say Z*10000+index or something instead of just index.

I know that there are workarounds such as: reordering all children in a loop; using addChildAt; adding extra sprite containers to the man scene sprite; etc, but all those require extra efforts, extra code, CPU time, etc.

What do you think?

Thanks

Vlad

Comments

Sign In or Register to comment.