Example #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!isDisposed)
            {
                if (disposing)
                {
                    if (Content != null)
                    {
                        Content.Dispose();
                    }

                    // FIXME: Does XNA4 require the GDM to be disposable? -flibit
                    (GraphicsDeviceManager.Instance as IDisposable).Dispose();

                    if (Window != null)
                    {
                        FNAPlatform.DisposeWindow(Window);
                    }

                    ContentTypeReaderManager.ClearTypeCreators();
                }

                AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;

                isDisposed = true;
            }
        }
Example #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_isDisposed)
            {
                if (disposing)
                {
                    // Dispose loaded game components.
                    for (int i = 0; i < _components.Count; i += 1)
                    {
                        IDisposable disposable = _components[i] as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    _components = null;

                    if (_content != null)
                    {
                        _content.Dispose();
                        _content = null;
                    }


                    if (_graphicsDeviceService != null)
                    {
                        // FIXME: Does XNA4 require the GDM to be disposable? -flibit
                        (_graphicsDeviceService as IDisposable).Dispose();
                        _graphicsDeviceService = null;
                    }

                    AudioDevice.Dispose();

                    if (Window != null)
                    {
                        FNAPlatform.DisposeWindow(Window);
                        Window = null;
                    }
                    Mouse.WindowHandle = IntPtr.Zero;

                    ContentTypeReaderManager.ClearTypeCreators();
                }

                AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;

                _isDisposed = true;
            }
        }
Example #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!isDisposed)
            {
                if (disposing)
                {
                    // Dispose loaded game components.
                    for (int i = 0; i < Components.Count; i += 1)
                    {
                        IDisposable disposable = Components[i] as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }

                    if (Content != null)
                    {
                        Content.Dispose();
                    }

                    if (graphicsDeviceService != null)
                    {
                        // FIXME: Does XNA4 require the GDM to be disposable? -flibit
                        (graphicsDeviceService as IDisposable).Dispose();
                    }

                    if (Window != null)
                    {
                        FNAPlatform.DisposeWindow(Window);
                    }

                    ContentTypeReaderManager.ClearTypeCreators();
                }

                AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;

                isDisposed = true;
            }
        }