protected virtual bool BeginDraw() { if (graphicsDeviceManager != null) { return(graphicsDeviceManager.BeginDraw()); } return(true); }
protected virtual bool BeginDraw() { if (isFixedTimeStep && gameUpdateTime.IsRunningSlowly) { return(false); } return(graphicsManager.BeginDraw()); }
/// <summary> /// Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw. /// </summary> /// <returns><c>true</c> to continue drawing, false to not call <see cref="Draw"/> and <see cref="EndDraw"/></returns> protected virtual bool BeginDraw() { beginDrawOk = false; if ((graphicsDeviceManager != null) && !graphicsDeviceManager.BeginDraw()) { return(false); } // Setup default command list if (GraphicsContext == null) { GraphicsContext = new GraphicsContext(GraphicsDevice); Services.AddService(GraphicsContext); } else { // Reset allocator GraphicsContext.ResourceGroupAllocator.Reset(GraphicsContext.CommandList); GraphicsContext.CommandList.Reset(); } beginDrawOk = true; // Clear states GraphicsContext.CommandList.ClearState(); // Perform begin of frame presenter operations if (GraphicsDevice.Presenter != null) { GraphicsContext.CommandList.ResourceBarrierTransition(GraphicsDevice.Presenter.DepthStencilBuffer, GraphicsResourceState.DepthWrite); GraphicsContext.CommandList.ResourceBarrierTransition(GraphicsDevice.Presenter.BackBuffer, GraphicsResourceState.RenderTarget); GraphicsDevice.Presenter.BeginDraw(GraphicsContext.CommandList); } return(true); }