Fullscreen Issues

So I am in the process of implementing a fullscreen mode into my game (that is using WindowsDX) and realized that monogame seems to have a lot of problems with it.

  1. When using HardwareModeSwitch = true and minimizing and maximizing the fullscreen window the resolution of the game will change resulting in windows/monitor freaking out.
  2. Going into fullscreen mode on my second monitor crashed the game. But after changing the refresh rate of my second monitor this problem is gone (switching to another and than back to the original, so the refresh rate did not change). So I am not sure where this was coming from and now I can not reproduce this behavior.
  3. When HardwareModeSwitch = false and the window is maximized going into fullscreen does not work correctly. The taskbar stays visible and the game window is not exactly at the corner.
  4. In borderless fullscreen you can press win+down and the windows will change into the normal state while still not having the FormBorderStyle = FormBorderStyle.None. So the user can not move the smaller window.

I wonder if this stuff works for other people or is nobody using fullscreen modes?

I do my fullscreen like this: Fullscreen mode - Learn MonoGame

I don’t know if it will solve your issues though, I don’t experience any crashes on any of my monitors.

So this does not solve any of the problems described. I have them solved in my game but in a really hacky way and it would be better if this stuff would just work out of the box.


Which platforms are you targeting? Also are you using DesktopGL or WindowsDX?

I am using WindowsDX. I just tried DesktopGL and the problems seem to not be there. But the switching between fullscreen does not work as good as with WindowsDX.

Yes, Monogame is generally really good but the full screen support certainly isn’t perfect. I can reproduce your points 1, 3, and 4 on my system too. Very interested to hear about any fixes people have for these things, even hacky ones. Mine for point (3) is to change the preferred back buffer size - doesn’t actually matter to what - and apply before switching to full screen. Be aware though that this back buffer size will be used to set the window size when you come back out of full screen. The other two are new to me as I never use win-down to minimise normally!

For point 1 I have a OnResize listener that checks if the WindowState changes to FormWindowState.Minimized. If that the case I call Graphics.ToggleFullScreen() to deactivate the fullscreen mode and then I minimize the window. Now after that I check if the WindowState changes to FormWindowState.Normal I call Graphics.ToggleFullScreen() again switch back into fullscreen mode.

For point 3 and 4 I do not use Graphics.ToggleFullScreen() but my own code:

var screenBounds = System.Windows.Forms.Screen.GetBounds(_windowForm);
_windowForm.FormBorderStyle = FormBorderStyle.None;
_windowForm.WindowState = FormWindowState.Normal;
_windowForm.Bounds = screenBounds;

The difference is that WindowState get set to FormWindowState.Normal instead of FormWindowState.Maximized. This does somehow prevent the two problems. Win + dir does nothing in this case.

I also have code to remember window sizes so that the window does remember the position + size when switching back from the fullscreen mode.

Yes that helps I think, been trying to keep platform specific overrides to a minimum (I also have a GL build for Linux) and avoid Forms references, but may have to live with it for now. Had a little dig in the Monogame source code, this stuff lives in a class called WinFormsGameWindow and some of it could maybe be fixed fairly easily by someone who knows how it works (I don’t!). Might be worth raising a bug report, this stuff gets updated a bit every version I think, as 3.8 does seem to have less problems in this area than 3.7 did.

Yes I will look into it and create a bug report. The thing about this is that I just don’t trust windows and this would need to be tested on other systems to make sure that it works as intended.

1 Like

Just to chime in so you know your not crazy, I also struggled with this and think Monogame has bugs.

1 Like