Exemple #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            if (_currentState != GameState.Playing)
            {
                _spriteBatch.Begin();
            }

            switch (_currentState)
            {
            case GameState.IntroScreen:
                _introScreen.Draw(gameTime, _spriteBatch);
                break;

            case GameState.MainMenu:
                _mainMenu.Draw(gameTime, _spriteBatch);
                break;

            case GameState.Playing:
                if (_overworld != null)
                {
                    _overworld.Draw(GraphicsDevice, gameTime, _spriteBatch, Window.ClientBounds);
                }
                break;

            case GameState.LoadGame:
                _loadscreen.Draw(gameTime, _spriteBatch);
                break;

            case GameState.Options:
                _options.Draw(gameTime, _spriteBatch);
                break;

            case GameState.Credits:
                _credits.Draw(gameTime, _spriteBatch);
                break;

            case GameState.LoadingGame:
            case GameState.NewGame:
                _loadingScreen.Draw(gameTime, _spriteBatch);
                break;

            case GameState.HowToPlay:
                _howToPlay.Draw(gameTime, _spriteBatch);
                break;

            case GameState.GameOver:
                _gameOver.Draw(gameTime, _spriteBatch);
                break;

            case GameState.Saving:
                _savescreen.Draw(gameTime, _spriteBatch);
                break;
            }

            if (_currentState != GameState.Playing)
            {
                _spriteBatch.End();
            }

            base.Draw(gameTime);
        }