@Paposo: thanks!
I didn't know about the second argument in the list.Sort() function.
I made some corrections in your code:
I didn't know about the second argument in the list.Sort() function.
I made some corrections in your code:
Function SortZ(bAscending% = True) glElements.Sort(bAscending, CompareZ) End Function ' This function is used for sorting the glSprites list in Z-order (ascending) Function CompareZ:Int(o1:Object, o2:Object) Local e1:TElement = TElement(o1) Local e2:TElement = TElement(o2) Return e1.piZ - e2.piZ End Function