AddRef() public static method

Gets a reference to the singleton instance.
public static AddRef ( IntPtr windowHandle, int width, int height ) : GraphicsDeviceService
windowHandle System.IntPtr
width int
height int
return GraphicsDeviceService
Beispiel #1
0
        /// <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;
                DrawTimer          = new Timer();
                DrawTimer.Enabled  = true;
                DrawTimer.Interval = 16;
                DrawTimer.Tick    += new EventHandler(DrawTimer_Tick);
                Initialize();
                initialized = true;
            }

            base.OnCreateControl();
        }
Beispiel #2
0
 /// <summary>Initializes the control.</summary>
 protected override void OnCreateControl()
 {
     if (!this.DesignMode)
     {
         this.graphicsDeviceService = GraphicsDeviceService.AddRef(this.Handle, this.ClientSize.Width, this.ClientSize.Height);
         this.services.AddService <IGraphicsDeviceService>((IGraphicsDeviceService)this.graphicsDeviceService);
         this.Initialize();
     }
     base.OnCreateControl();
 }
Beispiel #3
0
        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();
        }
Beispiel #5
0
        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);
                }
            }
        }