protected override void Draw(GameTime gameTime) { if (_coreGame != null) { _coreGame.Draw(gameTime); return; } GraphicsDevice.Clear(Color.Black); var width = GraphicsDevice.PresentationParameters.BackBufferWidth; var height = GraphicsDevice.PresentationParameters.BackBufferHeight; _splashSpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); var rect = new Rectangle(0, 0, width, height); if (_splash != null) { _splashSpriteBatch.Draw( _splash, rect, Color.White); } _splashSpriteBatch.End(); if (!_hasStartedDelayLoad && _coreGame == null) { ThreadPool.QueueUserWorkItem(o => { var result = StartupSequence.Start(new string[0]); _pendingCoreGame = result.GameInstance; }); _hasStartedDelayLoad = true; } }
public void Render(TimeSpan totalTimeSpan, TimeSpan elapsedTimeSpan) { var didPush = false; if (_coreGame.RenderContext != null && _coreGame.RenderContext.GraphicsDevice != null) { _graphicsDeviceService.RenderTarget.AcquireLock(1234, 1000000); _coreGame.RenderContext.PushRenderTarget(_graphicsDeviceService.RenderTarget); didPush = true; } _coreGame.GraphicsDevice.Clear(Color.Red); _coreGame.Draw(new GameTime(totalTimeSpan, elapsedTimeSpan)); if (didPush) { _coreGame.RenderContext.PopRenderTarget(); _coreGame.GraphicsDevice.Flush(); _coreGame.GraphicsDevice.Metrics = new GraphicsMetrics(); _graphicsDeviceService.RenderTarget.ReleaseLock(1234); } }