The SetResolution method sets the resolution (number of pixels wide and tall) of your game. This method can be called at any time after FlatRedBall is initialized.
The following code resizes the screen to display a resolution of 320X240.
Resolutions can be changed by calling SetResolution multiple times. For example, the following code allows the user to press the 1 or 2 keys to change between two resolutions:
By default if SetResolution is called, the Camera will adjust its DestinationRectangle according to the changed resolution. This automatic adjustment depends on the Camera's split screen viewport settings. For more information, see the SetSplitScreenViewport page.
One common piece of code that people use (incorrectly) to set the game resolution to the entire display's resolution is:
While this may seem fine, let's investigate what happens. The SetResolution method sets the resolution to the monitor's width/height; however, it can't actually set it to the full height. The reason for this is because Windows prevents the game window from being much taller than your current resolution. In other words, Windows resizes your game window's height to allow for the title bar and window borders. Here's a screen shot from Visual Studio showing the variables being different: Notice that the code above sets the resolution to the GraphicsDevice.DisplayMode.Height which clearly shows up as 768 on my monitor; however, the FlatRedBallServices.GraphicsOptions.ResolutionHeight (stored in a height variable) is only 752. The moral of the story is - when in windowed mode, don't set your resolution to the monitor's full-screen resolution.