0

I haven't been able to find any good tutorials for making a game fullscreen while maintaining the aspect ratio. It's a bit difficult for me to describe in words, so I'll show you in two pictures.

What I currently have:
https://dl.dropbox.com/u/51911679/Pictures/Whocares/Screenshots/whatIgot.jpg

What I want:
https://dl.dropbox.com/u/51911679/Pictures/Whocares/Screenshots/whatIwant.jpg

cb4
  • 6,689
  • 7
  • 45
  • 57
  • 1
    FYI don't use external links to host your images, you can imbed them in your question. A lot of people don't have access to places like dropbox at work. – Jastill Apr 09 '13 at 06:21

1 Answers1

2

The GraphicsDeviceManager class can handle most of this for you:

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        graphics.IsFullScreen = true;
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;

        //...
    }

Now, you have to make sure you're actually drawing the whole screen in your SpriteBatch coordinates (base them on your width & height).

  • Is there any way to dynamically scale everything for different resolutions- instead of going to every rectangle and saying rectangle.width=screenwidth/somenumber; – DylanAHolcomb Apr 10 '13 at 02:01
  • If you targeted a different resolution for all your calls, you can either simply change them all (only once, and start targeting the new one), or try [my answer here](http://stackoverflow.com/questions/7602852/scaling-entire-screen-in-xna/7603116#7603116). –  Apr 10 '13 at 02:04