예제 #1
0
        /// <summary>
        /// Dispose of current Window.
        /// </summary>
        /// <param name="disposing">If <c>false</c> we are being called from the Finalizer.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (SdlHandle != IntPtr.Zero)
            {
                if (disposing)
                {
                    // Dispose managed state (managed objects).
                    Disposed?.Invoke(this, EventArgs.Empty);
                    Application.UnregisterWindow(this);
                }

#if STRIDE_GRAPHICS_API_OPENGL
                // Dispose OpenGL context
                DummyGLContext?.Dispose();
                DummyGLContext = null;
                if (glContext != IntPtr.Zero)
                {
                    SDL.SDL_GL_DeleteContext(glContext);
                    glContext = IntPtr.Zero;
                }
#endif

                // Free unmanaged resources (unmanaged objects) and override a finalizer below.
                SDL.SDL_DestroyWindow(SdlHandle);
                SdlHandle = IntPtr.Zero;
                Handle    = IntPtr.Zero;
            }
        }
예제 #2
0
 public void Dispose()
 {
     context.Dispose();
 }