internal ViewHandler(int width, int height, int windowWidth, int windowHeight, bool fullscreen) { Width = width; Height = height; MononokeGame game = MononokeGame.Instance; _graphics = new GraphicsDeviceManager(game); _graphics.DeviceReset += OnGraphicsReset; _graphics.DeviceCreated += OnGraphicsCreate; game.Window.AllowUserResizing = true; game.Window.ClientSizeChanged += OnClientSizeChanged; Fullscreen = fullscreen; if (fullscreen) { SetFullscreen(); UpdateView( GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height ); } else { SetWindowed(windowWidth, windowHeight); UpdateView(windowWidth, windowHeight); } }
private void OnClientSizeChanged(object sender, EventArgs e) { MononokeGame game = MononokeGame.Instance; if (game.Window.ClientBounds.Width > 0 && game.Window.ClientBounds.Height > 0 && !_resizing) { _resizing = true; _graphics.PreferredBackBufferWidth = game.Window.ClientBounds.Width; _graphics.PreferredBackBufferHeight = game.Window.ClientBounds.Height; UpdateView(); _resizing = false; } }