Ejemplo n.º 1
0
		/// <summary>
		/// Disposes the control.
		/// </summary>
		protected override void Dispose(bool disposing) {
			if (mGraphicsDeviceService != null) {
				mGraphicsDeviceService.Release(disposing);
				mGraphicsDeviceService = null;
			}

			base.Dispose(disposing);
		}
Ejemplo n.º 2
0
        /// <summary>
        /// Gets a reference to the singleton instance.
        /// </summary>
        public static GraphicsDeviceService AddRef(IntPtr windowHandle, int width, int height) {
            // Increment the "how many controls sharing the device" reference count.
            if (Interlocked.Increment(ref referenceCount) == 1) {
                // If this is the first control to start using the
                // device, we must create the singleton instance.
                singletonInstance = new GraphicsDeviceService(windowHandle, width, height);
            }

            return singletonInstance;
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Initializes the control.
		/// </summary>
		protected override void OnCreateControl() {
			if (!DesignMode) {
				mGraphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height);

				// Register the service, so components like ContentManager can find it.
				mServices.AddService<IGraphicsDeviceService>(mGraphicsDeviceService);

				// Give derived classes a chance to initialize themselves.
				Initialize();
			}

			base.OnCreateControl();
		}
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void OnCreateControl()
        {
            if (!DesignMode)
            {
                mGraphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height);

                // Register the service, so components like ContentManager can find it.
                mServices.AddService <IGraphicsDeviceService>(mGraphicsDeviceService);

                // Give derived classes a chance to initialize themselves.
                Initialize();
            }

            base.OnCreateControl();
        }