Sunday 11 October 2009

Reflection - a lazy programmers best friend

I've been working on a replacement text rendering system recently, and as part of that, I needed access to font information such as the source rectangles for each character. Unfortunately, the SpriteFont class does not expose these, so I needed my own font class. If only it were possible to specify a new replacement content reader... but no problem, I thought, I'll just have to implement a new processor.

Except that's a lot of work. And I'm lazy. So I'm just gunna reflect over a loaded SpriteFont and steal it's data.

No comments:

Post a Comment