I created a fresh MONOGAME app using Visual Studio 2022. Total fresh, from scratch.
This is all I changed:
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = “Content”;
IsMouseVisible = true;
_graphics.PreferredBackBufferWidth = 2560;
_graphics.PreferredBackBufferHeight = 1440;
Window.IsBorderless = true;
_graphics.IsFullScreen = true;
_graphics.HardwareModeSwitch = true;
_graphics.SynchronizeWithVerticalRetrace = true;
_graphics.ApplyChanges();
}
If you do the above, then run the code it should display a BLUE screen.
Now, take a window and DRAG another window across the blue screen. (your app is still running in Visual Studio)
What I get is the window you are trying to drag caused the monogame to kind of minimize and then it will show up as a white screen and it looks to have crashed.
Any ideas what is going on and more importantly how to fix it. My game is nearly complete and I was adding resolution switching to the game, which I got working well, but as I was testing it looks like monogame does not behave very well.
Thanks! Steve
if I change the Window.IsBorderLess=true to false, it functions but only if you are using the default resolution of the monitor. It still does not work correctly if you use a non-default resolution and I could sure use help trying to understand how to fix it.
If you change the code to the below, run, then move a window over the running game, it will fail. It does not really crash, but it does not recover and restore the proper resolution.
Th
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
_graphics.PreferredBackBufferWidth = 1600;
_graphics.PreferredBackBufferHeight = 1200;
Window.IsBorderless = false;
_graphics.IsFullScreen = true;
_graphics.HardwareModeSwitch = true;
_graphics.SynchronizeWithVerticalRetrace = true;
_graphics.ApplyChanges();
}
This is an artifact of Windows draw rules and Monogame’s screen update code.
When a window’s display area is overwritten windows provides an invalidated rectangle message and the client is expected to redraw the effected portion.
In Monogame, the current screen only exists on the GPU. In order to restore the image Monogame must perform a complete Draw() call to restore the screen.
You can set Monogame to run when it does not have focus, but the cons outweigh the pros.
So it is not something that is fixed? I was looking at another game I have Terria, and when the window is dragged on top of it, it just minimizes itself - super clean.
Is there a work around? ifyou look at the example I provided, it doesn’t stop drawing so what keeps it from redrawing the screen.