This project is read-only.

Change Game Resolution

Jan 5, 2011 at 7:55 PM

Im trying to set the game resolution to 1024x768.

I started using the SnakeGame as a template and copy/paste my working XNA game, made a few changes and the was working using 800x600.

So i tried changing a few parameters like:

graphics.PreferredBackBufferWidth = Main.screenWidth;
graphics.PreferredBackBufferHeight = Main.screenHeight;
graphics.GraphicsDevice.PresentationParameters.BackBufferWidth = Main.screenWidth;
graphics.GraphicsDevice.PresentationParameters.BackBufferHeight = Main.screenHeight;
graphics.GraphicsDevice.Root.MinWidth = Main.screenWidth;
graphics.GraphicsDevice.Root.MinHeight = Main.screenHeight;
graphics.GraphicsDevice.Root.Width = Main.screenWidth;
graphics.GraphicsDevice.Root.Height = Main.screenHeight;
Viewport v = graphics.GraphicsDevice.Viewport;
v.Width = Main.screenWidth;
v.Height = Main.screenHeight;
graphics.GraphicsDevice.Viewport = v;

inside the Initialize() method.

Also in Page.xaml, the properties:

MinWidth="1024" MinHeight="768"
Width="1024" Height="768"

are also set.

I double check all those variables while running the game and values are correct: 1024 and 768.

But the drawing is not. The screen is clipped to 800x600 and the rest is filled with the CornflowerBlue color which I currently dont use to clear any of my rendertargets. The game works and while there are some components of the game that should be drawing where the CornflowerBlue color appears, they respond to mouse clicks. For example: There is a minimap in the top right corner of the game. I can't see it because of the "clipped area", but if I click with the mouse where it should be drawing the minimap, the game register the click and moves the screen to the desired location.

If I use the 800 x 600 resolution, the game works without this trouble.


So, the question is there any other place to modify the resolution of the game?

Jan 7, 2011 at 5:17 PM

My bad, I was using the stable DLL. I started using the project itself and its working now.

Jan 8, 2012 at 1:26 AM

I'm having this same issue. What exactly did you mean by "using the project itself"?