Example #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)
        {
            // Start drawing the ScreenElements
            base.Draw(gameTime);

            // Draw the current screen
            currentScreen.Draw(gameTime.ElapsedGameTime);

            SpriteBatch.Begin();
            debugString.Append("Elapsed update time: ").Concat(stopWatch.ElapsedMilliseconds, 0);
            SpriteBatch.DrawString(debugFont, debugString,
                                   new Vector2(GraphicsDevice.Viewport.Width - 160f, 0), Color.White);
            debugString.Clear();
            SpriteBatch.End();

            // Swap screen for the next frame
            if (nextScreen != currentScreen)
            {
                currentScreen = nextScreen;
            }

            stopWatch.Stop();
        }