Exemplo n.º 1
0
        protected override void Destroy()
        {
            DestroyPlatformDevice();

            // Notify listeners
            if (Disposing != null)
            {
                Disposing(this, EventArgs.Empty);
            }

            SamplerStates.Dispose();
            BlendStates.Dispose();
            RasterizerStates.Dispose();
            if (DepthStencilBuffer != null)
            {
                DepthStencilBuffer.Dispose();
            }
            primitiveQuad.Dispose();

            SamplerStates      = null;
            BlendStates        = null;
            RasterizerStates   = null;
            DepthStencilStates = null;

            base.Destroy();
        }
 public void Dispose()
 {
     mainCharacterService.Dispose();
     levelService.Dispose();
     audioDevice.Dispose();
     textures.Dispose();
     samplerStates.Dispose();
     inputController.Dispose();
     directX2DGraphics.Dispose();
     renderer.Dispose();
     directX3DGraphics.Dispose();
     renderForm.Dispose();
 }
Exemplo n.º 3
0
        protected override void Destroy()
        {
            // Clear shared data
            for (int index = sharedDataToDispose.Count - 1; index >= 0; index--)
            {
                sharedDataToDispose[index].Dispose();
            }
            sharedDataPerDevice.Clear();
            sharedDataPerDeviceContext.Clear();

            SamplerStates.Dispose();
            SamplerStates = null;

            DefaultPipelineState.Dispose();

            PrimitiveQuad.Dispose();

            // Notify listeners
            if (Disposing != null)
            {
                Disposing(this, EventArgs.Empty);
            }

            // Destroy resources
            lock (Resources)
            {
                foreach (var resource in Resources)
                {
                    // Destroy leftover resources (note: should not happen if ResumeManager.OnDestroyed has properly been called)
                    if (resource.LifetimeState != GraphicsResourceLifetimeState.Destroyed)
                    {
                        resource.OnDestroyed();
                        resource.LifetimeState = GraphicsResourceLifetimeState.Destroyed;
                    }

                    // Remove Reload code in case it was preventing objects from being GC
                    resource.Reload = null;
                }
                Resources.Clear();
            }

            DestroyPlatformDevice();

            base.Destroy();
        }
Exemplo n.º 4
0
        protected override void Destroy()
        {
            DestroyPlatformDevice();

            // Notify listeners
            if (Disposing != null)
            {
                Disposing(this, EventArgs.Empty);
            }

            SamplerStates.Dispose();
            PrimitiveQuad.Dispose();

            SamplerStates = null;

            // Clear shared data
            sharedDataPerDevice.Clear();
            sharedDataPerDeviceContext.Clear();

            // Destroy resources
            lock (Resources)
            {
                foreach (var resource in Resources)
                {
                    // Destroy resources
                    resource.OnDestroyed();
                    resource.LifetimeState = GraphicsResourceLifetimeState.Destroyed;

                    // Remove Reload code in case it was preventing objects from being GC
                    resource.Reload = null;
                }
                Resources.Clear();
            }

            base.Destroy();
        }