/// <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)
        {
            // Set the viewport to the entire screen
            GraphicsDevice.Viewport = gameViewport;
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            float elapsedGameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

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

            spriteBatch.Begin();

//            tilemap.Draw(elapsedGameTime, spriteBatch);

            //GameObjectManager.Draw(elapsedGameTime, spriteBatch);


            spriteBatch.End();

            // Render the gui
            GraphicsDevice.Viewport = guiViewport;

            base.Draw(gameTime);
        }
示例#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)
        {
            // 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:
                // TODO: Render splash screen
                break;

            case GameState.Gameplay:

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

                // Render the gui
                GraphicsDevice.Viewport = guiViewport;
                // TODO: Render gui

                break;

            case GameState.Scoring:
                // TODO: Render the end-of-level scoring screen
                break;

            case GameState.Credits:
                // TODO: Render the credits screen
                break;
            }

            base.Draw(gameTime);
        }