Custom Compare() method causes problems...

BlitzMax Forums/BlitzMax Programming/Custom Compare() method causes problems...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

@Paposo: thanks!
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