Ryan Foy
Ryan Foy

Reputation: 322

Screen Resizing C# 2010

I may be just missing something but when I try to use: System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width or graphicsDevice.PresentationParameters.BackBufferWidth;, I am not able to use these.

I may be missing something to call on them on the content loader:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;

Upvotes: 0

Views: 91

Answers (1)

Marcel Croonenbroeck
Marcel Croonenbroeck

Reputation: 20

you could change it with the GraphicsDeviceManager.

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        graphics.PreferredBackBufferHeight = 1080;   //Height
        graphics.PreferredBackBufferWidth = 1920;  //Width
        graphics.IsFullScreen = true;    //Fullscreen On/off
        graphics.ApplyChanges();   //Execute Changes!!!IMPORTANT!!!
        //if you want use/change the PresentationParameters.BackBufferWidth, you could do it with the GraphicsDevice which could be found in the GraphicsDeviceManager Class
        graphics.GraphicsDevice.PresentationParameters.BackBufferWidth;
    }

Upvotes: 1

Related Questions