/// <summary> /// Draws information in the display viewport. /// Resets the GraphicsDevice's context and makes the sceneViewport active. /// Has Game invoke all DrawableGameComponents Draw(GameTime). /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { draws++; display.Viewport = defaultViewport; //sceneViewport; display.Clear(Color.Black); //CornflowerBlue (Changed to black by David Kopp) // Draw into inspectorViewport display.Viewport = inspectorViewport; spriteBatch.Begin(); inspector.Draw(spriteBatch); spriteBatch.End(); // need to restore state changed by spriteBatch // GraphicsDevice.BlendState = BlendState.Opaque; // GraphicsDevice.DepthStencilState = DepthStencilState.Default; // GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; // draw objects in stage display.Viewport = sceneViewport; // Set background to a jpeg called stars. By David Kopp (Lines 581 - 583) spriteBatch.Begin(); spriteBatch.Draw(background, Vector2.Zero); spriteBatch.End(); display.RasterizerState = RasterizerState.CullNone; //// need to restore state changed by spriteBatch (Moved by David Kopp) GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; base.Draw(gameTime); // draw all GameComponents and DrawableGameComponents }
/// <summary> /// Draws information in the display viewport. /// Resets the GraphicsDevice's context and makes the sceneViewport active. /// Has Game invoke all DrawableGameComponents Draw(GameTime). /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { draws++; display.Viewport = defaultViewport; //sceneViewport; display.Clear(Color.CornflowerBlue); // Draw into inspectorViewport display.Viewport = inspectorViewport; spriteBatch.Begin(); inspector.Draw(spriteBatch); spriteBatch.End(); // need to restore state changed by spriteBatch GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; // draw objects in stage display.Viewport = sceneViewport; display.RasterizerState = RasterizerState.CullNone; base.Draw(gameTime); // draw all GameComponents and DrawableGameComponents }