Sorting / Ordering OnscreenImages and DirectGui Elements

Is there a away to control the render order of onscreen images? I’ve created an inventory where you can pick up and move items; I’d like to make it so that the picked up item is drawn on top of everything. Currently, the render order is based upon the order I loaded the images. Additionally, what if I want to control the order for ‘n’ elements that are not necessarily loaded in the order they should be drawn?

e.g If I have to load images in the order w, x, y, z, but I want the images to be ordered (from back to front) in z, x, w, y

You can use setBin to specify the render order. The second argument is an integer that will be used for sorting the nodes.

This worked for the most part. Do I have to do anything special for children of a node I have fixed the bin on?

e.g.

Node x has setBin(‘fixed’, 30) and it’s children y and z have setBin(‘fixed’, 31), but the children don’t render on top of the parent.

That should work. There’s nothing special about the parent-child relationship in regards to binning. So there must be something else that’s causing problems for you.

David