Ejemplo n.º 1
0
        protected override void Dispose(bool disposing)
        {
            if (this.service != null)
            {
                this.service.Release(disposing);
                this.service = null;

                if (this.gameLoopThread != null && this.gameLoopThread.IsAlive)
                {
                    this.gameLoopThread.Abort();
                }
            }
            base.Dispose(disposing);
        }
Ejemplo n.º 2
0
		protected override void Dispose(bool disposing) {
			if (this.service != null) {
				this.service.Release(disposing);
				this.service = null;

				if (this.gameLoopThread != null && this.gameLoopThread.IsAlive) {
					this.gameLoopThread.Abort();
				}
			}
			base.Dispose(disposing);
		}
Ejemplo n.º 3
0
		protected override void OnCreateControl() {
			if (!this.DesignMode) {
				this.service = GraphicsDeviceService.AddReference(
					Handle,
					ClientSize.Width,
					ClientSize.Height);

				this.service.DeviceReset += new EventHandler<EventArgs>(onDeviceReset);
				this.services.AddService<IGraphicsDeviceService>(service);

				if (this.GameLoopEnabled) {
					this.gameLoopThread = new Thread(this.gameLoop);
					this.gameLoopThread.IsBackground = true;
					this.gameLoopThread.Priority = ThreadPriority.Normal;

					this.gameLoopThread.Start();
				} else {
					this.LoadContent();
				}
			}
			base.OnCreateControl();
		}
Ejemplo n.º 4
0
		public static GraphicsDeviceService AddReference(IntPtr windowHandle, int width, int height) {
			if (Interlocked.Increment(ref referenceCount) == 1) {
				instance = new GraphicsDeviceService(windowHandle, width, height);
			}
			return instance;
		}