/// <summary> /// Disposes the control. /// </summary> protected override void Dispose(bool disposing) { if (graphicsDeviceService != null) { graphicsDeviceService.Release(disposing); graphicsDeviceService = null; } base.Dispose(disposing); }
/// <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; }
/// <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); }
protected override void Dispose(bool disposing) { if (_deviceService != null) { try { _deviceService.Release(); } catch { } _deviceService = null; } base.Dispose(disposing); }
/// <summary> /// Disposes the control. /// </summary> protected override void Dispose(bool disposing) { if (gameTimer != null) { gameTimer.Dispose(); } if (graphicsDeviceService != null) { graphicsDeviceService.Release(disposing); graphicsDeviceService = null; } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (graphicsDeviceService != null) { graphicsDeviceService.Release(disposing); graphicsDeviceService = null; } if (_renderTarget != null) { _renderTarget.Dispose(); _renderTarget = null; } base.Dispose(disposing); }
protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); services.AddService <IGraphicsDeviceService>(graphicsDeviceService); _renderTarget = new SwapChainRenderTarget(GraphicsDevice, Handle, ClientSize.Width, ClientSize.Height); Initialize(); } base.OnCreateControl(); }
/// <summary> /// Initializes the control. /// </summary> protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); // Register the service, so components like ContentManager can find it. services.AddService<IGraphicsDeviceService>(graphicsDeviceService); // Give derived classes a chance to initialize themselves. Initialize(); } base.OnCreateControl(); }
/// <summary> /// Initializes the control. /// </summary> protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); // Register the service, so components like ContentManager can find it. services.AddService <IGraphicsDeviceService>(graphicsDeviceService); // Give derived classes a chance to initialize themselves. Initialize(); } base.OnCreateControl(); }
protected override void OnCreateControl() { if (!DesignMode) { _deviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); _services.AddService <IGraphicsDeviceService>(_deviceService); if (ControlInitializing != null) { ControlInitializing(this, EventArgs.Empty); } Initialize(); if (ControlInitialized != null) { ControlInitialized(this, EventArgs.Empty); } } }
protected override void OnCreateControl() { if (!DesignMode) { _deviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); _services.AddService<IGraphicsDeviceService>(_deviceService); if (ControlInitializing != null) { ControlInitializing(this, EventArgs.Empty); } Initialize(); if (ControlInitialized != null) { ControlInitialized(this, EventArgs.Empty); } } }
/// <summary> /// Initializes the control. /// </summary> protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); // Register the service, so components like ContentManager can find it. services.AddService<IGraphicsDeviceService>(graphicsDeviceService); // Give derived classes a chance to initialize themselves. gametime = new GameTime(); starttime = DateTime.Now; currentframetime = DateTime.Now; this.DrawTimer = new Timer(); this.DrawTimer.Enabled = true; this.DrawTimer.Interval = 16; this.DrawTimer.Tick += new System.EventHandler(this.DrawTimer_Tick); Initialize(); initialized = true; } base.OnCreateControl(); }
/// <summary> /// Initializes the control. /// </summary> protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if ( !DesignMode ) { this._graphicsDeviceService = this.Services.Resolve<GraphicsDeviceService>( new NamedParameter( "windowHandle", this.Handle ), new NamedParameter( "width", 800 ), new NamedParameter( "height", 600 ) ); // Give derived classes a chance to initialize themselves. this._stopWatch.Start(); this.LoadContent(); this.Initialize(); this.IntializeThread(); this._updateThread.Start(); } base.OnCreateControl(); }
protected override void Dispose( bool disposing ) { this.UnloadContent(); this._graphicsDeviceService = null; base.Dispose( disposing ); }