Tutorial Project's Window Size

Jun 14, 2013 at 3:40 AM
I can't seem to figure out how to change the screen size. The tutorial images seem to be able to display the entire map screen, but when I compile and run it, I only get that much.

I checked the properties of anything I could to see if there was a way to change the game region but I cannot find it. Appreciate any help anyone can give me.

Image
Coordinator
Jun 14, 2013 at 9:11 AM
Can you post the code that set's the device manager's preferred back buffer width and height, and also the code that sets the viewport dimensions?
Jun 14, 2013 at 12:41 PM
The code given in the tutorial on this site only explicitly sets the viewport's dimensions, which only affects what's displayed in the window, not the window itself. Changing that around has no affect on the window.

I wrote the code exactly as its shown on this website. If I was supposed to set up the window dimensions manually myself, its not in the code given on the site.
Coordinator
Jun 14, 2013 at 2:09 PM
Edited Jun 14, 2013 at 2:09 PM
You can set the window size as per the code below (taken from the demo code in the Source Code section):
       public DemoGame()
        {
            m_graphicsDeviceManager = new GraphicsDeviceManager(this);

#if XBOX
            m_graphicsDeviceManager.PreferredBackBufferWidth = 1280;
            m_graphicsDeviceManager.PreferredBackBufferHeight = 720;
#elif WINDOWS_PHONE
            m_graphicsDeviceManager.IsFullScreen = true;
#endif

            Content.RootDirectory = "Content";
        }
This code sets explicit dimensions for the Xbox version and ensures it is in full screen mode as per WP7 requirements (it leaves the default window dimensions for PC). If you are running in windowed mode on a PC, you can basically set PreferredBackBufferWidth and PreferredBackBufferHeight to the desired window size.
Jun 14, 2013 at 2:23 PM
Edited Jun 14, 2013 at 2:33 PM
Thank you, that helped.

I thought I had already checked the properties of that myself, but I guess I didn't well enough. Thanks again.

I'm just a beginner overlooking something that I should've been able to find myself :p