Borderless full screen at non native resolution

Hi, what’s the clean way to setup borderless full screen at resolution that isn’t native to the display? Basically looking to undersample game for 4k displays if users wants to.

What I have now:

SCREEN_MANAGER.graphics.PreferredBackBufferWidth = width;
SCREEN_MANAGER.graphics.PreferredBackBufferHeight = height;
SCREEN_MANAGER.graphics.ApplyChanges();
SCREEN_MANAGER.Resize(); //Handles resize of GUI and RTs

form.WindowState = System.Windows.Forms.FormWindowState.Normal;
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
form.Bounds = new System.Drawing.Rectangle(0, 0, 1920,1200); //placeholder hardset values
form.DesktopLocation = new System.Drawing.Point(0, 0);

This pretty much works, however mouse position is off by ration of target resolution and native resolution, other than that it works just fine.

Do you not draw everything to a render target before drawing to the backbuffer? If you don’t that’s the solution. Then you can just make the render target 4x smaller than the screen for 4k displays. MonoGame keeps window size and backbuffer size the same, so using a render target is the recommended path.

GUI is not rendered into RT, but I actually don’t feel like upscaling last RT would be correct solution here, apart from issues with rescaling GUI, I do not believe I seen the game that would approach nonnative resolution this way. I am not going for pixel art or something here. From top of my head Warhammer Total War, WoW, Battlerite… usually referred as “Borderless fullscreen”, I really don’t believe either of them downscale into RT which is then upscaled (meaning that window itself would be rendered at native resolution, which I am pretty sure is not).

Code I wrote in OP renders borderless full screen with non-native resolution (so same thing that most of the game I have installed can do) but the issue remains with the mouse. So I was just checking if there is, in C# in general, way how to remap cursor area. I can multiple cursor position by scale factor obtained as ratio between native and target resolution, but I was wondering if there is something cleaner on lower level I could use.

Not that i know of…

1 Like