XNA Disable Auto Fit to Screen

67 views Asked by At

I'm using the XNA 4.0 framework to create a business intelligence screen that will be projected in a control room. The screen itself is designed to fit on two 1920 * 1080 projectors in series.

Currently I'm defining the resolution of the screen as follows:

    graphics.PreferredBackBufferWidth = 3840;
    graphics.PreferredBackBufferHeight = 1080;

However if I run the solution, XNA automatically 'squashes' the 2D graphics so that the entire screen fits on my primary 1920 * 1080 screen. How do you disable this 're-sizing' functionality in XNA? What I want to achieve is one big screen that I can show across two 1920 * 1080 monitors. Not a squashed screen that fits on one monitor.

Note that my XNA knowledge is very limited. I'm using SpriteFonts and Texture2D to create the graphic objects

1

There are 1 answers

4
Nahuel Ianni On BEST ANSWER

Your solution should work if you are setting those values on the Game class constructor and have configured the screens to expand content between themselves.

Another, not really recommended, way to do it is to apply the changes on either the Initialize or LoadContent method.

In order to do this, just add the following line after setting the dimensions:

this.graphics.ApplyChanges();

So your whole thing would look like this:

protected virtual void Initialize()
{
    this.graphics.PreferredBackBufferWidth = 1024;
    this.graphics.PreferredBackBufferHeight = 600;
    this.graphics.ApplyChanges();
}

If you do not want to use the ApplyChanges method, you can set the values on the class constructor without calling this method.

Also, be sure to check that the graphics.IsFullScreen property is not set to true.