Search code examples
c#xnatexture2d

Texture2D to front


Is there any option to set the mouse texture to the front of the screen?

The mouse pointer and the blocks are Texture2Ds, is it possible to draw the pointer in front of the other textures? enter image description here


Solution

  • There is a SpriteBatch.Draw() overload that allows you to set the layer depth. setting it to 0 places the texture in front and setting it to 1 places it in the back. But it only applies within a Begin/end block.

    Most likely, you can achieve what you want by simply drawing it last and it will go on top(or front) of all other drawn items.