If your windows desktiop can’t change to 800x600 then the game can’t, you need to specify the same aspect ratio as your monitor allows - do this calculation:
- 1080/1920 = 0.5625
- 800 * (result of 1) 0.5625 = 450
- result = 800x450 for the same aspect ration as your 1920x1080 monitor. you should then be able to go full screen at that resolution.
You need to use some sort of adaptor to draw your screen with letter/pillar box style, below is a link that might help:
http://www.david-amador.com/2010/03/xna-2d-independent-resolution-rendering/
Below is the full Resolution.cs code I use now:
//////////////////////////////////////////////////////////////////////////
////License: The MIT License (MIT)
////Copyright (c) 2010 David Amador (http://www.david-amador.com)
////Direct Link: http://www.david-amador.com/2010/03/xna-2d-independent-resolution-rendering/
////Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
////
////The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
////
////THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace Project1
{
public static class MouseHelper
{
/// <summary>
/// Translates the actual mouse position obtained from Mouse.GetState() into the virtual mouse position after a scaling matrix is applied to the viewport
/// </summary>
public static Point CurrentMousePosition
{
get
{
MouseState mouse = Mouse.GetState();
var mousePosition = new Vector2(mouse.X, mouse.Y);
var virtualViewport = new Vector2(Resolution.VirtualViewportX, Resolution.VirtualViewportY);
mousePosition = Vector2.Transform(mousePosition - virtualViewport, Matrix.Invert(Resolution.GetTransformationMatrix()));
var virtualMousePosition = new Point((int)mousePosition.X, (int)mousePosition.Y);
return virtualMousePosition;
}
}
}
internal static class Resolution
{
private static bool _fullScreen = false;
private static GraphicsDeviceManager _graphicsDevice = null;
private static bool _recreateScaleMatrix = true;
private static Matrix _scaleMatrix;
private static int _screenHeight = 720; // Actual Screen size
private static int _screenWidth = 1400; // Actual Screen size
private static int _virtualHeight = 720; // Size to display at / design size
private static int _virtualWidth = 1280; // Size to display at / design size
static public Rectangle VirtualViewport
{
get
{
return new Rectangle(0, 0, _virtualWidth, _virtualHeight);
}
}
public static int VirtualViewportX { get; private set; }
public static int VirtualViewportY { get; private set; }
/// <summary>
/// Sets the device to use the draw pump
/// Sets correct aspect ratio
/// </summary>
static public void BeginDraw()
{
// Start by reseting viewport to (0,0,1,1)
FullViewport();
// Calculate Proper Viewport according to Aspect Ratio
ResetViewport();
// Clear to Black
_graphicsDevice.GraphicsDevice.Clear(Color.Black);
}
static public void FullViewport()
{
var viewport = new Viewport(0, 0, _screenWidth, _screenHeight);
_graphicsDevice.GraphicsDevice.Viewport = viewport;
}
static public Matrix GetTransformationMatrix()
{
if (_recreateScaleMatrix)
{
RecreateScaleMatrix();
}
return _scaleMatrix;
}
/// <summary>
/// Get virtual Mode Aspect Ratio
/// </summary>
/// <returns>aspect ratio</returns>
static public float GetVirtualAspectRatio()
{
return (float)_virtualWidth / (float)_virtualHeight;
}
static public void Initialize(GraphicsDeviceManager device)
{
_screenWidth = device.PreferredBackBufferWidth;
_screenHeight = device.PreferredBackBufferHeight;
_graphicsDevice = device;
_recreateScaleMatrix = true;
ApplyResolutionSettings();
}
static public void ResetViewport()
{
float targetAspectRatio = GetVirtualAspectRatio();
// figure out the largest area that fits in this resolution at the desired aspect ratio
int width = _graphicsDevice.PreferredBackBufferWidth;
int height = (int)(width / targetAspectRatio + .5f);
bool changed = false;
if (height > _graphicsDevice.PreferredBackBufferHeight)
{
height = _graphicsDevice.PreferredBackBufferHeight;
// PillarBox
width = (int)(height * targetAspectRatio + .5f);
changed = true;
}
// set up the new viewport centered in the back buffer
var viewport = new Viewport();
viewport.X = (_graphicsDevice.PreferredBackBufferWidth / 2) - (width / 2);
viewport.Y = (_graphicsDevice.PreferredBackBufferHeight / 2) - (height / 2);
viewport.Width = width;
viewport.Height = height;
viewport.MinDepth = 0;
viewport.MaxDepth = 1;
VirtualViewportX = viewport.X;
VirtualViewportY = viewport.Y;
if (changed)
{
_recreateScaleMatrix = true;
}
_graphicsDevice.GraphicsDevice.Viewport = viewport;
}
static public void SetResolution(int width, int height, bool fullScreen)
{
_screenWidth = width;
_screenHeight = height;
_fullScreen = fullScreen;
ApplyResolutionSettings();
}
static public void SetVirtualResolution(int virtualWidth, int virtualHeight)
{
_virtualWidth = virtualWidth;
_virtualHeight = virtualHeight;
_recreateScaleMatrix = true;
}
static private void ApplyResolutionSettings()
{
#if XBOX360
Resolution.fullScreen = true;
#endif
// If we aren't using a full screen mode, the height and width of the window can
// be set to anything equal to or smaller than the actual screen size.
if (_fullScreen == false)
{
if ((_screenWidth <= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width)
&& (_screenHeight <= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height))
{
_graphicsDevice.PreferredBackBufferWidth = _screenWidth;
_graphicsDevice.PreferredBackBufferHeight = _screenHeight;
_graphicsDevice.IsFullScreen = _fullScreen;
_graphicsDevice.ApplyChanges();
}
}
else
{
// If we are using full screen mode, we should check to make sure that the display
// adapter can handle the video mode we are trying to set. To do this, we will
// iterate through the display modes supported by the adapter and check them against
// the mode we want to set.
foreach (DisplayMode displayMode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{
// Check the width and height of each mode against the passed values
if (displayMode.Width == _screenWidth && displayMode.Height == _screenHeight)
{
// The mode is supported, so set the buffer formats, apply changes and return
_graphicsDevice.PreferredBackBufferWidth = _screenWidth;
_graphicsDevice.PreferredBackBufferHeight = _screenHeight;
_graphicsDevice.IsFullScreen = _fullScreen;
_graphicsDevice.ApplyChanges();
break;
}
}
}
_recreateScaleMatrix = true;
_screenWidth = _graphicsDevice.PreferredBackBufferWidth;
_screenHeight = _graphicsDevice.PreferredBackBufferHeight;
}
static private void RecreateScaleMatrix()
{
_recreateScaleMatrix = false;
_scaleMatrix = Matrix.CreateScale(
(float)_graphicsDevice.GraphicsDevice.Viewport.Width / _virtualWidth,
(float)_graphicsDevice.GraphicsDevice.Viewport.Height / _virtualHeight,
1f);
}
}
}