Page 1 of 1
4 Replies - 3633 Views - Last Post: 06 December 2011 - 04:05 PM
2D Sprite Depth
Posted 06 December 2011 - 01:04 AM
I've been trying to figure out a way to control the draw depth of certain 2D sprite layers in my games. I've read that one option is to use SpriteSortMode BackToFront specifying a layerDepth for each texture. Apparently doing this doesn't really allow the SpriteBatch to do it's job though. (from this article) The only other method I could think of would be to iterate through all entities multiple times, each time drawing only any entities of the correct depth. That seems way too costly to me. Has anyone found a better way to control the order in which sprites are drawn?
Replies To: 2D Sprite Depth
Re: 2D Sprite Depth
Posted 06 December 2011 - 03:07 AM
I have messed around with Draw Orders in an example project I was working on to draw Primitives, I only got around to drawing random sized Rectangles but I did get a working drag and drop style control that manipulated the current draw order of the shape making it draw the shape with the lowest numbered draw order last so that it appeared on top of every other shape. I can share this with you later if you wanted to have a look as I haven't got access to it atm.
Page 1 of 1