Microsoft.Xna.Framework.Graphics.RenderTarget2D.Dispose C# (CSharp) Метод

Dispose() защищенный Метод

protected Dispose ( bool disposing ) : void
disposing bool
Результат void
        protected override void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                Threading.BlockOnUIThread(() =>
                {
                    this.GraphicsDevice.PlatformDeleteRenderTarget(this);
                });
            }

            base.Dispose(disposing);
        }
    }

Usage Example

Пример #1
0
        public BasicLightableScene(Graphics.Graphics graphics)
        {
            int width, height;
            width = graphics.GetGraphicsDeviceManager().GraphicsDevice.Viewport.Width;
            height = graphics.GetGraphicsDeviceManager().GraphicsDevice.Viewport.Height;

            Camera = new Camera2D();

            LightScene = new RenderTarget2D(graphics.GetGraphicsDeviceManager().GraphicsDevice,
                width, height);
            BaseScene = new RenderTarget2D(graphics.GetGraphicsDeviceManager().GraphicsDevice,
                width, height);

            _Entities = new List<IAnimatedEntity>();
            _StaticLights = new List<LightSource>();

            if (!Minecraft2D.ScaleGame)
            {
                graphics.ResolutionChanged += (sender, e) =>
                {
                    Console.WriteLine("[BasicLightableScene] Destroying and recreating render targets.");

                    width = graphics.GetGraphicsDeviceManager().GraphicsDevice.Viewport.Width;
                    height = graphics.GetGraphicsDeviceManager().GraphicsDevice.Viewport.Height;
                    LightScene.Dispose();
                    BaseScene.Dispose();

                    LightScene = new RenderTarget2D(graphics.GetGraphicsDeviceManager().GraphicsDevice,
                        width, height);
                    BaseScene = new RenderTarget2D(graphics.GetGraphicsDeviceManager().GraphicsDevice,
                        width, height);
                };
            }
        }
All Usage Examples Of Microsoft.Xna.Framework.Graphics.RenderTarget2D::Dispose