MrGravity.WorldSelect.Draw C# (CSharp) Method

Draw() public method

Draws the menu on the screen
public Draw ( SpriteBatch spriteBatch, Matrix scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch Canvas we are drawing to
scale Matrix
return void
        public void Draw(SpriteBatch spriteBatch, Matrix scale)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate,
                BlendState.AlphaBlend,
                SamplerState.LinearClamp,
                DepthStencilState.None,
                RasterizerState.CullCounterClockwise,
                null,
                scale);

            spriteBatch.Draw(_mBackground, _mGraphics.GraphicsDevice.Viewport.Bounds, Color.White);

            DrawLevelPanel(spriteBatch);
            DrawTitleBar(spriteBatch);

            if (_mShowCongrats)
            {
                _mWorldUnlocked = false;
                spriteBatch.Draw(_mLastCongrats, new Vector2(_mScreenRect.Center.X - _mLastCongrats.Width / 2, _mScreenRect.Center.Y - _mLastCongrats.Height / 2), Color.White);
            }

            if (_mWorldUnlocked && _mUnlockedTimer < 45 && !TrialMode)
            {
                Vector2 size = _mFontBig.MeasureString("New World Unlocked");
                spriteBatch.Draw(_mUnlockedDialog, new Rectangle((int)(_mScreenRect.Center.X - size.X / 2 - size.X / 4), (int)(_mScreenRect.Center.Y - 3*size.Y/2),
                    (int)(size.X + size.X / 2), (int)(3*size.Y)), Color.White);
                _mUnlockedTimer++;
            }
            else if (_mUnlockedTimer >= 45)
            {
                _mUnlockedTimer = 0;
                _mWorldUnlocked = false;
            }

            //Draw loading screen
            if (_mLoading == StartLoad)
            {
                spriteBatch.Draw(_mLoadingBg, new Vector2(_mScreenRect.Center.X - _mLoadingBg.Width / 2,
                    _mScreenRect.Center.Y - _mLoadingBg.Height / 2), Color.White);

                _mLoading = Loading;
            }
            spriteBatch.End();
        }