Пример #1
0
        void graphics_PreparingDeviceSettings(object sender,
            PreparingDeviceSettingsEventArgs e)
        {

            e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = drawSurface;

        }
Пример #2
0
 private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     DisplayMode displayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
     e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = displayMode.Format;
     e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = displayMode.Width;
     e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = displayMode.Height;
 }
 void CBeroGraphicsDeviceManager_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     if (m_WndHndl != IntPtr.Zero)
     {
         e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = m_WndHndl;
     }
 }
Пример #4
0
        private void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            PresentationParameters presentationParams = e.GraphicsDeviceInformation.PresentationParameters;

            presentationParams.BackBufferWidth = RenderWidth;
            presentationParams.BackBufferHeight = RenderHeight;
            presentationParams.DeviceWindowHandle = _windowHandle;
            presentationParams.RenderTargetUsage = RenderTargetUsage.PreserveContents;
        }
Пример #5
0
        private void Graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            Graphics.PreferredBackBufferWidth = DefaultResolution.X;
            Graphics.PreferredBackBufferHeight = DefaultResolution.Y;

            //Graphics.GraphicsProfile = GraphicsProfile.HiDef;
            Graphics.SynchronizeWithVerticalRetrace = true;
            //Graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
        }
Пример #6
0
 private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     //graphics.IsFullScreen = true;
     graphics.PreferredBackBufferWidth = 1280;
     graphics.PreferredBackBufferHeight = 720;
     graphics.PreferMultiSampling = true;
     graphics.GraphicsProfile = GraphicsProfile.HiDef;
     graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
     graphics.ApplyChanges();
 }
Пример #7
0
        protected override void OnPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.One;

            // use 4-bit (per channel) color format for WP7. Atleast Omnia 7 has a horrible banding with SurfaceFormat.Color.
            // Lumia's don't probably have but whatever
            if (OperatingSystemHelper.Version == WindowsPhoneVersion.WP7)
            {
                e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = SurfaceFormat.Bgra4444;
            }
        }
Пример #8
0
 void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     try
     {
         e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.Two;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Пример #9
0
		private void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) {
			var pp = e.GraphicsDeviceInformation.PresentationParameters;
			var adapter = e.GraphicsDeviceInformation.Adapter;

			var dispFormat = adapter.CurrentDisplayMode.Format;
			var dephFormat = pp.DepthStencilFormat;

			SurfaceFormat selectedFormat;
			DepthFormat selectedDepthFormat;
			int selectedMultiSampleCount;
			if (adapter.QueryRenderTargetFormat(GraphicsProfile.HiDef, dispFormat, dephFormat, 4, out selectedFormat, out selectedDepthFormat, out selectedMultiSampleCount)) {
				pp.MultiSampleCount = 4;
			} else if (adapter.QueryRenderTargetFormat(GraphicsProfile.HiDef, dispFormat, dephFormat, 2, out selectedFormat, out selectedDepthFormat, out selectedMultiSampleCount)) {
				pp.MultiSampleCount = 2;
			}

		}
        /// <summary>
        /// This populates a GraphicsDeviceInformation instance and invokes PreparingDeviceSettings to
        /// allow users to change the settings. Then returns that GraphicsDeviceInformation.
        /// Throws NullReferenceException if users set GraphicsDeviceInformation.PresentationParameters to null.
        /// </summary>
        private GraphicsDeviceInformation DoPreparingDeviceSettings()
        {
            var gdi = new GraphicsDeviceInformation();

            PrepareGraphicsDeviceInformation(gdi);

            if (PreparingDeviceSettings != null)
            {
                // this allows users to overwrite settings through the argument
                var args = new PreparingDeviceSettingsEventArgs(gdi);
                PreparingDeviceSettings(this, args);

                if (gdi.PresentationParameters == null || gdi.Adapter == null)
                {
                    throw new NullReferenceException("Members should not be set to null in PreparingDeviceSettingsEventArgs");
                }
            }

            return(gdi);
        }
Пример #11
0
        private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            nativeScreenWidth = graphics.PreferredBackBufferWidth;
            nativeScreenHeight = graphics.PreferredBackBufferHeight;

            if (nativeScreenWidth == 1920)
            {
                graphics.PreferredBackBufferWidth = 1920;
                graphics.PreferredBackBufferHeight = 1080;
            }
            else
            {
                //graphics.PreferredBackBufferWidth = 1920;
                //graphics.PreferredBackBufferHeight = 1080;
                graphics.PreferredBackBufferWidth = 1280;
                graphics.PreferredBackBufferHeight = 720;
                //graphics.IsFullScreen = true;
            }
            graphics.PreferMultiSampling = true;
            graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;

            graphics.ApplyChanges();
        }
Пример #12
0
        private void OnPreparingDeviceSettings(object sender, Xna.PreparingDeviceSettingsEventArgs e)
        {
            var pp = e.GraphicsDeviceInformation.PresentationParameters;
            var desktopDisplayMode = e.GraphicsDeviceInformation.Adapter.CurrentDisplayMode;

            pp.RenderTargetUsage = RenderTargetUsage.PreserveContents;
            pp.IsFullScreen      = true;

            if (pp.IsFullScreen)
            {
                pp.BackBufferWidth  = desktopDisplayMode.Width;
                pp.BackBufferHeight = desktopDisplayMode.Height;
            }
            else
            {
                var form    = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(this.game.Window.Handle);
                int borderX = form.Size.Width - form.ClientSize.Width;
                int borderY = form.Size.Height - form.ClientSize.Height;

                pp.BackBufferWidth  = desktopDisplayMode.Width - borderX;
                pp.BackBufferHeight = desktopDisplayMode.Height - borderY;
            }
        }
Пример #13
0
        private void Initialize()
        {
            _game.Window.SetSupportedOrientations(_supportedOrientations);

            var presentationParameters = new PresentationParameters();

            PreparePresentationParameters(presentationParameters);

            // Allow for any per-platform changes to the presentation.
            PlatformInitialize(presentationParameters);

            // TODO: Implement multisampling (aka anti-alising) for all platforms!
            if (PreparingDeviceSettings != null)
            {
                var gdi = new GraphicsDeviceInformation();
                gdi.GraphicsProfile        = GraphicsProfile; // Microsoft defaults this to Reach.
                gdi.Adapter                = GraphicsAdapter.DefaultAdapter;
                gdi.PresentationParameters = presentationParameters;
                var pe = new PreparingDeviceSettingsEventArgs(gdi);
                PreparingDeviceSettings(this, pe);
                presentationParameters = pe.GraphicsDeviceInformation.PresentationParameters;
                GraphicsProfile        = pe.GraphicsDeviceInformation.GraphicsProfile;
            }

            // Create and initialize the graphics device.
            _graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile, presentationParameters);

            // Set the new display size on the touch panel.
            //
            // TODO: In XNA this seems to be done as part of the
            // GraphicsDevice.DeviceReset event... we need to get
            // those working.
            //
            TouchPanel.DisplayWidth       = _graphicsDevice.PresentationParameters.BackBufferWidth;
            TouchPanel.DisplayHeight      = _graphicsDevice.PresentationParameters.BackBufferHeight;
            TouchPanel.DisplayOrientation = _graphicsDevice.PresentationParameters.DisplayOrientation;
        }
        private void InitialiseDevice(object sender, PreparingDeviceSettingsEventArgs e)
        {
            PresentationParameters pp =
                e.GraphicsDeviceInformation.PresentationParameters;

            foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters)
            {             
                if (adapter.Description.Contains("NVIDIA PerfHUD"))
                {
                    GraphicsAdapter.UseReferenceDevice = true;
                    e.GraphicsDeviceInformation.Adapter = adapter;

 
                    break;
                }
            }

            GraphicsAdapter defaultAdapter = GraphicsAdapter.DefaultAdapter;

            //if ( defaultAdapter.IsWideScreen )
                RenderManager.Instance.BaseResolution = new Vector2(1280, 720);
           // else
               // RenderManager.Instance.BaseResolution = new Vector2(1024, 768);
        }
Пример #15
0
 void graphics_PreparingDeviceSettings(object sender,
 PreparingDeviceSettingsEventArgs e)
 {
     foreach (Microsoft.Xna.Framework.Graphics.DisplayMode displayMode
         in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
     {
         if (displayMode.Width == 800 && displayMode.Height == 600)
         {
             e.GraphicsDeviceInformation.PresentationParameters.
                 BackBufferFormat = displayMode.Format;
             e.GraphicsDeviceInformation.PresentationParameters.
                 BackBufferHeight = displayMode.Height;
             e.GraphicsDeviceInformation.PresentationParameters.
                 BackBufferWidth = displayMode.Width;
         }
     }
 }
Пример #16
0
 protected virtual void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
     e.GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat = DepthFormat.Depth24Stencil8;
     e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = SurfaceFormat.Color;
 }
Пример #17
0
		/// <summary> 
		/// Event capturing the construction of a draw surface and makes sure this gets redirected to 
		/// a predesignated drawsurface marked by pointer _drawSurface 
		/// </summary> 
		private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
		{
			e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = this._drawSurface;

			e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = Simulation3D.Form.pictureBoxSurface.Width;
			e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = Simulation3D.Form.pictureBoxSurface.Height;
		}
Пример #18
0
 void _graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     PresentationParameters pp = e.GraphicsDeviceInformation.PresentationParameters;
     pp.RenderTargetUsage = RenderTargetUsage.PreserveContents;
     e.GraphicsDeviceInformation.PresentationParameters = pp;
 }
Пример #19
0
 /// <summary>
 /// We need to override this device settings callback so that the correct back buffer it set.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected override void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     base.GraphicsPreparingDeviceSettings(sender, e);
     //            e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = 960;
     //            e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = 800;
 }
Пример #20
0
 private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     var currentDisplayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
     var width = currentDisplayMode.Width;
     var height = currentDisplayMode.Height;
     graphics.PreferredBackBufferWidth = Math.Min(width, 4096);
     graphics.PreferredBackBufferHeight = Math.Min(height, 4096);
     graphics.PreferMultiSampling = true;
     resolutionSet = false;
     graphics.PreparingDeviceSettings -= graphicsPreparedHandler;
     CanLoadContent = true;
 }
 void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 4;
 }
        private void Initialize()
        {
            var presentationParameters = new PresentationParameters();

            presentationParameters.DepthStencilFormat = DepthFormat.Depth24;

#if (WINDOWS || WINRT) && !DESKTOPGL
            _game.Window.SetSupportedOrientations(_supportedOrientations);

            presentationParameters.BackBufferFormat   = _preferredBackBufferFormat;
            presentationParameters.BackBufferWidth    = _preferredBackBufferWidth;
            presentationParameters.BackBufferHeight   = _preferredBackBufferHeight;
            presentationParameters.DepthStencilFormat = _preferredDepthStencilFormat;
            presentationParameters.IsFullScreen       = false;

#if WINDOWS_UAP
            presentationParameters.DeviceWindowHandle = IntPtr.Zero;
            presentationParameters.SwapChainPanel     = this.SwapChainPanel;
#else
            presentationParameters.DeviceWindowHandle = _game.Window.Handle;
#endif
#else
#if MONOMAC || DESKTOPGL
            presentationParameters.IsFullScreen = _wantFullScreen;
#elif WEB
            presentationParameters.IsFullScreen = false;
#else
            // Set "full screen"  as default
            presentationParameters.IsFullScreen = true;
#endif // MONOMAC
#endif // WINDOWS || WINRT

            // TODO: Implement multisampling (aka anti-alising) for all platforms!
            var preparingDeviceSettingsHandler = PreparingDeviceSettings;

            if (preparingDeviceSettingsHandler != null)
            {
                GraphicsDeviceInformation gdi = new GraphicsDeviceInformation();
                gdi.GraphicsProfile        = GraphicsProfile; // Microsoft defaults this to Reach.
                gdi.Adapter                = GraphicsAdapter.DefaultAdapter;
                gdi.PresentationParameters = presentationParameters;
                PreparingDeviceSettingsEventArgs pe = new PreparingDeviceSettingsEventArgs(gdi);
                preparingDeviceSettingsHandler(this, pe);
                presentationParameters = pe.GraphicsDeviceInformation.PresentationParameters;
                GraphicsProfile        = pe.GraphicsDeviceInformation.GraphicsProfile;
            }

            // Needs to be before ApplyChanges()
            _graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile, this.PreferHalfPixelOffset, presentationParameters);

#if !MONOMAC
            ApplyChanges();
#endif

            // Set the new display size on the touch panel.
            //
            // TODO: In XNA this seems to be done as part of the
            // GraphicsDevice.DeviceReset event... we need to get
            // those working.
            //
            TouchPanel.DisplayWidth       = _graphicsDevice.PresentationParameters.BackBufferWidth;
            TouchPanel.DisplayHeight      = _graphicsDevice.PresentationParameters.BackBufferHeight;
            TouchPanel.DisplayOrientation = _graphicsDevice.PresentationParameters.DisplayOrientation;
        }
Пример #23
0
        private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            nativeScreenWidth = graphics.PreferredBackBufferWidth;
            nativeScreenHeight = graphics.PreferredBackBufferHeight;

            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferMultiSampling = true;
            graphics.GraphicsProfile = GraphicsProfile.HiDef;
            graphics.SynchronizeWithVerticalRetrace = true;
            graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
            e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 16;
        }
Пример #24
0
        private void Initialize()
        {
            var presentationParameters = new PresentationParameters();

            presentationParameters.DepthStencilFormat = DepthFormat.Depth24;

#if WINDOWS || WINRT
            _game.Window.SetSupportedOrientations(_supportedOrientations);

            presentationParameters.BackBufferFormat   = _preferredBackBufferFormat;
            presentationParameters.BackBufferWidth    = _preferredBackBufferWidth;
            presentationParameters.BackBufferHeight   = _preferredBackBufferHeight;
            presentationParameters.DepthStencilFormat = _preferredDepthStencilFormat;
            presentationParameters.IsFullScreen       = false;

#if WINDOWS_PHONE
            // Nothing to do!
#elif WINDOWS_UAP
            presentationParameters.DeviceWindowHandle = IntPtr.Zero;
            presentationParameters.SwapChainPanel     = this.SwapChainPanel;
#elif WINDOWS_STORE
            // The graphics device can use a XAML panel or a window
            // to created the default swapchain target.
            if (this.SwapChainBackgroundPanel != null)
            {
                presentationParameters.DeviceWindowHandle       = IntPtr.Zero;
                presentationParameters.SwapChainBackgroundPanel = this.SwapChainBackgroundPanel;
            }
            else
            {
                presentationParameters.DeviceWindowHandle       = _game.Window.Handle;
                presentationParameters.SwapChainBackgroundPanel = null;
            }
#else
            presentationParameters.DeviceWindowHandle = _game.Window.Handle;
#endif
#else
#if MONOMAC
            presentationParameters.IsFullScreen = _wantFullScreen;
#elif LINUX
            presentationParameters.IsFullScreen = _wantFullScreen;
#else
            // Set "full screen"  as default
            presentationParameters.IsFullScreen = true;
#endif // MONOMAC
#endif // WINDOWS || WINRT

            // TODO: Implement multisampling (aka anti-alising) for all platforms!
            if (PreparingDeviceSettings != null)
            {
                GraphicsDeviceInformation gdi = new GraphicsDeviceInformation();
                gdi.GraphicsProfile        = GraphicsProfile; // Microsoft defaults this to Reach.
                gdi.Adapter                = GraphicsAdapter.DefaultAdapter;
                gdi.PresentationParameters = presentationParameters;
                PreparingDeviceSettingsEventArgs pe = new PreparingDeviceSettingsEventArgs(gdi);
                PreparingDeviceSettings(this, pe);
                presentationParameters = pe.GraphicsDeviceInformation.PresentationParameters;
                GraphicsProfile        = pe.GraphicsDeviceInformation.GraphicsProfile;
            }

            // Needs to be before ApplyChanges()
            _graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile, presentationParameters);

#if !MONOMAC
            ApplyChanges();
#endif

            // Set the new display size on the touch panel.
            //
            // TODO: In XNA this seems to be done as part of the
            // GraphicsDevice.DeviceReset event... we need to get
            // those working.
            //
            TouchPanel.DisplayWidth       = _graphicsDevice.PresentationParameters.BackBufferWidth;
            TouchPanel.DisplayHeight      = _graphicsDevice.PresentationParameters.BackBufferHeight;
            TouchPanel.DisplayOrientation = _graphicsDevice.PresentationParameters.DisplayOrientation;
        }
Пример #25
0
 protected virtual void OnPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs args)
 {
     if (this.PreparingDeviceSettings != null)
     {
         this.PreparingDeviceSettings(sender, args);
     }
 }
Пример #26
0
 private void GraphicsDevicePreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
 }
Пример #27
0
 ////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////////////////
 public DeviceEventArgs(PreparingDeviceSettingsEventArgs deviceSettings)
 {
   DeviceSettings = deviceSettings;
 } 
Пример #28
0
 /// <summary>
 /// When a graphics device is being created, we need to ensure swap effect copy is enabled
 /// so that the contents of the back buffer are not lost after multiple present calls.
 /// </summary>
 protected virtual void OnGraphicsDevicePrepareSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     e.GraphicsDeviceInformation.PresentationParameters.SwapEffect = SwapEffect.Copy;
 }
Пример #29
0
        /// <summary>
        /// Delegate for the GraphicsDeviceManager, which is used to change the resolution
        /// and the output window handle of the GraphicsDevice.
        /// </summary>
        void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            // Set the resolution
            e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = ResolutionWidth;
            e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = ResolutionHeight;

            // This is the most important part!
            // An XNA game which is triggered by Game.Run() creates it's own hosting window and uses
            // it's handle for defining the render output window of the GraphicsDeviceManager.
            // In this case there is no hosting window, so the output window handle has to be redirect!
            e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = this.m_windowHandle;

            e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
            e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen = false;

            e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 8;

            m_bLoaded = true;
        }
		void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
		{
#if DEBUG
			foreach (GraphicsAdapter curAdapter in GraphicsAdapter.Adapters) 
			{ 
				if (curAdapter.Description.Contains("PerfHUD"))
				{
					e.GraphicsDeviceInformation.Adapter = curAdapter;
					break;
				} 
			}
#endif
			e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = presentation;
		}
Пример #31
0
        ////////////////////////////////////////////////////////////////////////////  
        ////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Method used as an event handler for the GraphicsDeviceManager.PreparingDeviceSettings event.
        /// </summary>
        protected virtual void PrepareGraphicsDevice(object sender, PreparingDeviceSettingsEventArgs e)
        {
            e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = _RenderTargetUsage;
            int w = e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth;
            int h = e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight;

            foreach (Control c in Controls)
            {
                SetMaxSize(c, w, h);
            }

            if (DeviceSettingsChanged != null) DeviceSettingsChanged.Invoke(new DeviceEventArgs(e));
        }
Пример #32
0
 protected virtual void OnPreparingDeviceSettings(Object sender, PreparingDeviceSettingsEventArgs args)
 {
     //TODO
 }
Пример #33
0
 /// <summary>
 /// This method ensures that we can render to the back buffer without
 /// losing the data we already had in our previous back buffer.  This
 /// is necessary for the SkeletonStreamRenderer.
 /// </summary>
 /// <param name="sender">The sending object.</param>
 /// <param name="e">The event args.</param>
 private void GraphicsDevicePreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     // This is necessary because we are rendering to back buffer/render targets and we need to preserve the data
     e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
 }
Пример #34
0
 // TODO: Fullscreen does not work in current Mono?
 //public void SetFullscreenEnabled(bool enabled)
 //{
 //    if (enabled && graphicsDeviceManager.IsFullScreen == false ||
 //        enabled == false && graphicsDeviceManager.IsFullScreen)
 //    {
 //        // TODO: This does not work in the current MonoGame version.
 //        graphicsDeviceManager.ToggleFullScreen();
 //    }
 //}
 //public void ToggleFullscren()
 //{
 //    graphicsDeviceManager.ToggleFullScreen();
 //    graphicsDeviceManager.ApplyChanges();
 //}
 // TODO: PreparingDeviceSettings does only fire the first time applychanges is called (or maybe only before game started).
 private void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
     this.SetScreenSize(new MPoint2(e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth, e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight));
     //Vector2DInteger value = new Vector2DInteger(
     //        e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth,
     //        e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight
     //    );
     //ScreenSize = value;
     //ScreenCenter = value / 2;
 }
Пример #35
0
        /// <summary>
        /// Called when the GPU is getting new settings
        /// </summary>
        /// <param name="sender">The object requesting new device settings</param>
        /// <param name="e">The device settings that are getting set</param>
        private void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            PresentationParameters pp = e.GraphicsDeviceInformation.PresentationParameters;
            GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter;
            SurfaceFormat format = adapter.CurrentDisplayMode.Format;

            if (MultiSamples > 0 && MultiSamples != pp.MultiSampleCount)
            {
                pp.MultiSampleCount = MultiSamples;
            }
            else if (MultiSamples <= 0 && MultiSamples != pp.MultiSampleCount)
            {
                pp.MultiSampleCount = 0;
            }

            if (bloom != null)
            {
                bloom.sceneRenderTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight,
                    false,
                    format, pp.DepthStencilFormat, pp.MultiSampleCount,
                    RenderTargetUsage.DiscardContents);
            }
        }
Пример #36
0
        void graphics_PrepareDevice(object sender, PreparingDeviceSettingsEventArgs e)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                PresentationParameters presentParams =
                    e.GraphicsDeviceInformation.PresentationParameters;

                presentParams.RenderTargetUsage = RenderTargetUsage.PlatformContents;
                if (graphicsManager.PreferredBackBufferHeight == 720)
                {
                    presentParams.MultiSampleCount = 4;
#if !DEBUG
                    presentParams.PresentationInterval = PresentInterval.One;
#endif
                }
                else
                {
                    presentParams.MultiSampleCount = 2;
#if !DEBUG
                    presentParams.PresentationInterval = PresentInterval.Two;
#endif
                }
            }
        }