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?
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?
About the author
#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.
Torque Owner Christopher Perkins
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.