Game Development Community

Relative Sizing SpriteFonts

by Jacob Lynch · in Torque X 2D · 10/13/2009 (11:03 pm) · 2 replies

Hey, we'd like to put some information about the weapons in our game into a GUIMLText (like the stats on the weapon) and then display that to the screen. I can get that to work fine in one resolution, but the trick seems to be getting it displayed correctly in other resolutions. I have been using the VertSizing/HorizSizing properties to scale the GUIControls according to the resolution, which works well for everything but the text controls. It doesn't seem to scale the SpriteFont, which is understandable, I guess.

So here is the simple option. Put all the text inside a graphic, and have the graphic scaled automatically by Torque. This would work fine except we anticipate changing the stats/text frequently before the game is finished. We could save all this for last, I suppose. I was setting it up so that all the stats/text would be in an easily edited XML file, which would've been a lot easier.

Is there another, better option? Would it be worth it to write some code to try to detect which SpriteFont to scale to based on the resolution? How has anyone else handled this problem?

#1
10/14/2009 (1:32 am)
Honestly, with the XBox, I have two set resolutions(1280x720 and 640x480, though most games may stick with the 720 only since itll scale itself). In the demos I wrote that used both, I just had two different sizes of the font.

Just set the spritefont based on what the resolution is.

Another solution would be to render the text to a texture and scale the texture that's rendered.
#2
10/19/2009 (6:24 am)
I used different sized spritefonts for each resolution. They really are not that big, I was still able to keep within the 50M for a $1 game.