Depth Sorting

I’ve had a quick look into the depth sorting, and as the only way of dynamically manipulating the order appears to be using object.toFront()/object.toBack() which doesn’t offer much control.

The carousel demo seems to update the whole display list, which would work for me, but I’m concerned about the the performance overhead on a large list…

Is there any thing I’ve missed (better ways of working, different methods, etc.)??

Thanks [import]uid: 34358 topic_id: 9679 reply_id: 309679[/import]

how large?

using qsort - 0(n log n) p4mance would not matter as much -

i would add a z value to the object to figure out its depth to sort against it when using your compare function

local compare(obj1, obj2)  
return obj1-\>z \> obj2-\>z  
end  

c [import]uid: 24 topic_id: 9679 reply_id: 35246[/import]

Hi Carlos,

Thanks for the reply.

In the end I used the sort from the carousel example

  
table.sort(renderItems,   
 function(a, b)  
 return a.y \< b.y  
 end  
 )  

and then in my render loop set the object.toFront()

I’m not sure if this is as performant as possible, but, as often the way the I have optimised it as fars possible by ensuring the renderItems table is the minimum size it can be, [import]uid: 34358 topic_id: 9679 reply_id: 35265[/import]

that works

c. [import]uid: 24 topic_id: 9679 reply_id: 35268[/import]