예제 #1
0
 public static GraphicsDeviceService AddRef(IntPtr windowHandle, int width, int height)
 {
     if(Interlocked.Increment(ref referenceCount) == 1)
     {
         instance = new GraphicsDeviceService(windowHandle, width, height);
     }
     return instance;
 }
예제 #2
0
 protected override void OnCreateControl()
 {
     if (!DesignMode)
     {
         graphicsDeviceService = GraphicsDeviceService.AddRef(this.Handle, this.Width, this.Height);
         services.AddService(typeof(IGraphicsDeviceService), graphicsDeviceService);
         Initialize();
     }
     base.OnCreateControl();
 }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     if (graphicsDeviceService != null)
     {
         graphicsDeviceService.Release(disposing);
         graphicsDeviceService = null;
     }
     if (disposing)
         contentMgr.Unload();
     base.Dispose(disposing);
 }