Exemple #1
0
 void Dispose(bool manual)
 {
     if (!disposed)
     {
         lock (sync)
         {
             if (manual)
             {
                 Debug.Print("Disposing {0}", GetType());
                 InputDriver.Dispose();
                 if (Exists)
                 {
                     DestroyWindow();
                 }
             }
             else
             {
                 Debug.WriteLine("Sdl2NativeWindow leaked, did you forget to call Dispose()?");
                 if (Exists)
                 {
                     // If the main loop is still running, send a close message.
                     // This will raise the Closing/Closed events and then destroy
                     // the window.
                     // Todo: it is probably not safe to raise events once the
                     // finalizer has run. Review this.
                     Close();
                 }
             }
             disposed = true;
         }
     }
 }
Exemple #2
0
        protected virtual void Dispose(bool disposing)
        {
            Unregister();

            if (disposing)
            {
                _inputDriver?.Dispose();
                _joystick?.Dispose();

                _inputDriver = null;
                _joystick    = null;
            }
        }