示例#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.CornflowerBlue);

            _spriteBatch.Begin();
            _character.Draw(gameTime, _spriteBatch);
            _exitButton.Draw(_spriteBatch);

            var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            _frameCounter.Update(deltaTime);

            string fps = string.Format("FPS: {0}\r\nX: {1}\r\nY: {2}", _frameCounter.AverageFramesPerSecond, Mouse.GetState().X, Mouse.GetState().Y);

            _spriteBatch.DrawString(_font, fps, new Vector2(1, 1), Color.Black);

            _spriteBatch.End();

            base.Draw(gameTime);
        }