Sharpcraft.Sharpcraft.Draw C# (CSharp) Method

Draw() protected method

This is called when the game should draw itself.
protected Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Provides a snapshot of timing values.
return void
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            _spriteBatch.Begin();
            _spriteBatch.Draw(_crosshair, new Vector2(Mouse.GetState().X - 24, Mouse.GetState().Y - 24), Color.White);
            if (_gameMenuOpen)
            {
                //float tWidth = _menuFont.MeasureString("!!! GAME MENU OPEN !!!").X;
                //_spriteBatch.DrawString(_menuFont, "!!! GAME MENU OPEN !!!", new Vector2((float) GraphicsDevice.Viewport.Width / 2 - tWidth / 2, (float) GraphicsDevice.Viewport.Height / 2 + _menuFont.LineSpacing), Color.Yellow);
                var menuPos =
                    _menuLabel.GetCenterPosition(new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height),
                                                 new Vector2(0, _menuLabel.Height + 5));
                _spriteBatch.DrawString(_menuLabel.Font, _menuLabel.Text, menuPos, _menuLabel.ForeColor);
            }
            _spriteBatch.End();

            base.Draw(gameTime);
        }