Category: XNA, Monogame

Establishing display and game window size

Sample XNA code to establish a fixed size windowed view public Game1() { graphics = new GraphicsDeviceManager(this); // Determine the resolution of the screen int maxwidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; int maxheight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; // Set the game window to 90% of the avaiable resolution _windowWidth = (int) (0.9*maxwidth); _windowHeight = (int) (0.9*maxheight); graphics.PreferredBackBufferWidth = _windowWidth; graphics.PreferredBackBufferHeight = _windowHeight; // Block window size Window.AllowUserResizing = false; Content.RootDirectory = “Content”; } Alternatively, you can allow user resizing and […]