Skip to content
Discussion options

You must be logged in to vote

Here's something that works for me

public static class GameExtensions
{
    public static void SetResolution(this Game game, int width, int height, FullscreenMode mode)
    {
        game.GraphicsDeviceManager.PreferredBackBufferWidth = width;
        game.GraphicsDeviceManager.PreferredBackBufferHeight = height;
        game.GraphicsDeviceManager.ApplyChanges();

        game.Window.IsFullscreen = mode == FullscreenMode.Fullscreen;
        game.Window.IsBorderLess = mode == FullscreenMode.Borderless;
        game.Window.AllowUserResizing = false;

        if (mode == FullscreenMode.Borderless)
        {
            game.Window.Position = new ();
        }
    }
}

public enum FullscreenM…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@mihai-ene-public
Comment options

@HuangMiu
Comment options

Answer selected by HuangMiu
Comment options

You must be logged in to vote
1 reply
@HuangMiu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants