Skip to content

GraphicsDeviceManager.ApplyChanges behavior not the same #580

Description

@7aGiven

For XNA: normal
For FNA: when resize window by mouse, it will be auto center.

Test case:

using Microsoft.Xna.Framework;
using System;

namespace ConsoleApp2
{
    public static class Program
    {
        [STAThread]
        private static void Main(string[] args)
        {
            using (FNAGame g = new FNAGame())
                g.Run();
        }
    }

    class FNAGame : Game
    {
        GraphicsDeviceManager gdm;
        internal FNAGame()
        {
            gdm = new GraphicsDeviceManager(this);
            Window.AllowUserResizing = true;
        }
        protected override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (gdm.PreferredBackBufferWidth != gdm.GraphicsDevice.Viewport.Width || gdm.PreferredBackBufferHeight != gdm.GraphicsDevice.Viewport.Height)
            {
                gdm.PreferredBackBufferWidth = GraphicsDevice.Viewport.Width - 1;
                gdm.PreferredBackBufferHeight = GraphicsDevice.Viewport.Height - 1;
                gdm.ApplyChanges();
            }
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions