Question

The definition on MSDN website is:

layerDepth Type: Single The depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.

Can someone explain what this means please? Thanks.

Was it helpful?

Solution

It's equivalent to the z-order of normal windows, it's not related to the depth buffer or the z coordinate in the DirectX coordinate system.

If you draw two sprites at the same xy position, the one with the lower "layer depth" will be behind the one with the higher "layer depth".

If you use sorting, then the lower number layers (i.e. the ones at the back) will be drawn first, which is generally what you want.

Refer to this answer in response to a similar question, which has more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top