예제 #1
0
        public void Dispose()
        {
            if (m_hDC != IntPtr.Zero)
            {
                if (BeforeReleaseEvent != null)
                {
                    BeforeReleaseEvent(this);
                }
                BeforeReleaseEvent = null;

                //GameDebugger.Log("Disposing Device Context");
                IGE.Platform.Win32.API.Externals.ReleaseDC(((m_Window != null && !m_Window.Disposed) ? m_Window.Handle : IntPtr.Zero), m_hDC);
                m_hDC = IntPtr.Zero;
            }

            if (m_Window != null)
            {
                m_Window.CloseEvent -= OnBeforeWindowDestroy;
                m_Window             = null;
            }
        }
예제 #2
0
 public DeviceContext(Win32NativeWindow window)
 {
     m_hDC = IntPtr.Zero;
     if (window != null)
     {
         if (window.Disposed)
         {
             throw new Exception("Device context cannot be created because window does not exist anymore");
         }
         m_Window = window;
         GameDebugger.EngineLog(LogLevel.Debug, "Getting device context for the window");
         m_hDC = IGE.Platform.Win32.API.Externals.GetDC(m_Window.Handle);
         if (m_hDC != IntPtr.Zero)
         {
             m_Window.CloseEvent += OnBeforeWindowDestroy;
         }
     }
     else
     {
         GameDebugger.EngineLog(LogLevel.Debug, "Getting device context of the desktop");
         m_hDC = IGE.Platform.Win32.API.Externals.GetDC(IntPtr.Zero);                 // try getting device context of desktop ... whatever you might neeed it for :)
     }
 }