Search code examples
user-interfacescalingxna-4.0

UI scaling - XNA


(Sorry if I missed the answer)

So I just started out making an XNA game for windows.

And while designing the UI, I was wondering how to scale the UI at different resolutions. So, imagine that I make a UI for a 1920*1080 screen, how do I make sure this is displayed correctly on a smaller 4*3 screen?

Thanks in advance!

Simon.


Solution

  • Usually one designs the GUI in a way that will be usable in the lowest resolution your game offers (traditionally 800x600), then you are sure everything fits correctly at all resolutions.

    This is usually why games at higher resolutions seem to have a lot more space for the "playfield" and less for UI than at smaller resolutions.

    You could scale the UI once the resolution is higher as well, as easy as using the scale parameter on SpriteBatch.Draw, or you could do it a bit more smartly, by having your assets 9-sliced and aligned to WIDTH/HEIGHT constant percentages.