示例#1
0
        /// <summary>
        /// Resets the graphics device to whichever is bigger out of the specified
        /// resolution or its current size. This behavior means the device will
        /// demand-grow to the largest of all its GraphicsDeviceControl clients.
        /// </summary>
        public void ResetDevice(int width, int height)
        {
            DeviceResetting?.Invoke(this, EventArgs.Empty);

            parameters.BackBufferWidth  = Math.Max(parameters.BackBufferWidth, width);
            parameters.BackBufferHeight = Math.Max(parameters.BackBufferHeight, height);

            // TODO Replacement for this ?
            //graphicsDevice.Reset(parameters);

            DeviceReset?.Invoke(this, EventArgs.Empty);
        }
示例#2
0
        /// <summary>
        /// Resets the graphics device to whichever is bigger out of the specified
        /// resolution or its current size. This behavior means the device will
        /// demand-grow to the largest of all its GraphicsDeviceControl clients.
        /// </summary>
        public void ResetDevice(int width, int height)
        {
            var newWidth  = Math.Max(_parameters.BackBufferWidth, width);
            var newHeight = Math.Max(_parameters.BackBufferHeight, height);

            if (newWidth != _parameters.BackBufferWidth || newHeight != _parameters.BackBufferHeight)
            {
                DeviceResetting?.Invoke(this, EventArgs.Empty);

                _parameters.BackBufferWidth  = newWidth;
                _parameters.BackBufferHeight = newHeight;

                GraphicsDevice.Reset(_parameters);

                DeviceReset?.Invoke(this, EventArgs.Empty);

                GraphicsDevice.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
            }
        }
 // FIXME: Why does the GraphicsDeviceManager not know enough about the
 //        GraphicsDevice to raise these events without help?
 internal void OnDeviceResetting()
 {
     DeviceResetting?.Invoke(this);
 }
 private void GraphicsDevice_DeviceResetting(object sender, EventArgs e)
 {
     DeviceResetting?.Invoke(this, e);
 }