I have a function with the following code in it:
GameStateManagementGame.GraphicsDeviceManager.PreferredBackBufferWidth = width;
GameStateManagementGame.Graphics
The settings you set on GraphicsDeviceManager
are applied in these cases:
ApplyChanges()
ToggleFullScreen()
Game
when Game.Run()
is called (it creates the graphics device)Noteably, modifying any of the settings will not cause those settings to be applied immediately.
The likely reason for your flickering is that you are doing #3 and then immediately doing #1 (you are applying the settings twice in a row).
For initial start-up, you should set the correct settings on the GraphicsDeviceManager
instance during your game class's constructor. Then those settings will be correct when Game.Run()
is called.
Use ApplyChanges()
only when the user changes the settings while the game is running.