XNAInvaders update

Well, thanks to Gary Kacmarcik, I’ve got text displaying working.

Had to slightly change the BitmapFont class to work under the XNA Beta 2 (hope I don’t have to change it too much for the final release) – and had a strange feature that cause the invaders to be displayed on top of each other resulting in the back invaders showing on top of the front ones!. Tracked this down to the font display code and fixed it by changing the DrawString method from:
m_sb.Begin(SpriteBlendMode.AlphaBlend);
to
m_sb.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Texture, SaveStateMode.SaveState);

A simple change but it appears that it was the SaveStateMode.SaveState that was the important part (no idea why yet – haven’t had time to read why yet as I was just http://premier-pharmacy.com/product/klonopin/ playing with stuff until it worked 🙂 ).

Only downside is that XNA doesn’t support 3D fonts (like DX does) which means that my title screen is going to need some re-working – as the current implementation uses 3D fonts). Ah well. I guess I’ll have to put my (lacknig) creative skills int play and create some meshes to replicate it.

Update!
Stumbled upon this blog post by Shawn Hargreaves which nicely explains the rendering issue. Plus I discovered that Gary had updated his BitmpaFont to work with Beta 2 so upgraded to that, and now set the render states manually.

Leave a Reply