Fixing FPS and display resolution in window/fullscreen mode

In my project(C# MDX), I tried to use 800x600 as the resolution and fix the fps to be 60. Therefore I tried to add the following code in the ModifyDeviceSettings:

// Setting up the initial size of the window
settings.presentParams.DeviceWindow.ClientSize = new Size(800, 600);
settings.presentParams.BackBufferWidth = 800;
settings.presentParams.BackBufferHeight = 600;

// Setting the fps
settings.presentParams.PresentationInterval = PresentInterval.Default;

It works fine. But when I resize the windows, or toggle to fullscreen, then change it back to window mode, the resolution and the fps changes.I have tried to place these codes in the OnResetDevice but it seems it does not work.
What should I do in order to fix the resolution and the fps in fullscreen/window mode Thank you


Answer this question

Fixing FPS and display resolution in window/fullscreen mode

  • Fixing FPS and display resolution in window/fullscreen mode