ScrollingShooter.ScrollingShooterGame.Draw C# (CSharp) Method

Draw() protected method

This is called when the game should draw itself.
protected Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Provides a snapshot of timing values.
return void
        protected override void Draw(GameTime gameTime)
        {
            // Set the viewport to the entire screen
            GraphicsDevice.Viewport = gameViewport;
            GraphicsDevice.Clear(Color.Black);

            float elapsedGameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            // Render according to current game state
            switch (GameState)
            {
                case GameState.Splash:
                    spriteBatch.Begin(0, null, SamplerState.LinearClamp, null, null, null);
                    Splash.Draw(elapsedGameTime, spriteBatch);
                    spriteBatch.End();
                    break;

                case GameState.Gameplay:

                    // Render the game world
                    GraphicsDevice.Viewport = worldViewport;
                    LevelManager.Draw(elapsedGameTime);

                    // Render the gui
                    GraphicsDevice.Viewport = guiViewport;
                    GuiManager.DrawHUD(elapsedGameTime);

                    break;

                case GameState.Scoring:
                    // TODO: Render the end-of-level scoring screen
                    GuiManager.DrawScoringScreen(elapsedGameTime, spriteBatch);
                    break;
            }

            base.Draw(gameTime);
        }