What I wanted was instead something HUD-like.
To make it always appear on top, simply draw it last.
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
spriteBatch.Draw(someTexture,...);
spriteBatch.DrawString(...); //Will overwrite someTexture
spriteBatch.End();
Alternatively, there are overloads for Draw(...), DrawString(...), etc. that allow you to specify the layer depth used by spritebatch to sort sprites.
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.DrawString(,,,,,,,,,0); //Will overwrite someTexture
spriteBatch.Draw(someTexture,,,,,,,,100);
spriteBatch.End();
But you can also use multiple batches:
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.DrawString(,,,,,,,,0);
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
spriteBatch.Draw(someTexture,,,,,,,,100); //Different batch; will overwrite text
spriteBatch.End();
if you know how to change fontsize and other properties like the font itself (I don't like Arial this much) I would be extremely happy.
- Right click on Content -> Add -> New item -> SpriteFont Description -> Give it a name;
This creates a .spritefont file which contains very simple XML pointing to a particular [font]-[size] which is then used to build the XNB spritesheet. You can edit the .spritefont file with Notepad.