示例#1
0
        protected override void Draw(GameTime gameTime)
        {
            switch (_gameState)
            {
            case GameStateEnum.Game:
                if (Session != null)
                {
                    Session.Draw(spriteBatch);
                }
                else
                {
                    GraphicsDevice.Clear(Color.Black);
                }

                Hud.Draw(spriteBatch);
                GuiManager.Draw(spriteBatch);
                break;

            case GameStateEnum.Menu:
                MenuState.Draw(spriteBatch);
                break;

            case GameStateEnum.Intro:
                Intro.Draw(spriteBatch);
                break;
            }

            if (Console.Enabled)
            {
                Console.Draw(spriteBatch);
            }
        }
示例#2
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)
        {
            if (menuState)
            {
                GraphicsDevice.Clear(Color.CornflowerBlue);
                _spriteBatch.Begin();
                menu.Draw(_spriteBatch);
                _spriteBatch.End();
            }
            else
            {
                if (!pausedState && !gameOverState)
                {
                    if (hidden == true)
                    {
                        GraphicsDevice.Clear(Color.Black);
                    }
                    else
                    {
                        GraphicsDevice.Clear(Color.CornflowerBlue);
                        background.Draw(_spriteBatch, camera);
                    }

                    _spriteBatch.Begin(SpriteSortMode.BackToFront,
                                       null,
                                       SamplerState.LinearWrap,
                                       null, null, null,
                                       camera.GetViewMatrix(Vector2.One));
                    level.Draw(_spriteBatch);
                    _spriteBatch.End();
                    Feedback.Draw(_spriteBatch, camera);

                    base.Draw(gameTime);
                }
                else if (pausedState)
                {
                    _spriteBatch.Begin(SpriteSortMode.BackToFront,
                                       null,
                                       SamplerState.LinearWrap,
                                       null, null, null,
                                       camera.GetViewMatrix(Vector2.One));
                    pause.Draw(_spriteBatch);
                    _spriteBatch.End();
                }
            }
        }