Exemplo n.º 1
0
        /// <summary>
        /// Draw the current screen
        /// </summary>
        /// <param name="spriteBatch"></param>
        public void Draw(GameTime gametime, SpriteBatch spriteBatch)
        {
            if (current == null)
            {
                return;
            }

            // Transition to next screen
            if (transitionOut)
            {
                switch (current.TransitionOut)
                {
                case TransitionType.Instant:
                    current.Draw(gametime, spriteBatch);
                    break;

                case TransitionType.Fade:
                    current.Draw(gametime, spriteBatch);
                    spriteBatch.Draw(onePixel, new Rectangle(0, 0, Constants.WINDOW_WIDTH, Constants.WINDOW_HEIGHT), Color.Black * transOutVariable);
                    break;

                default:
                    break;
                }
            }
            // Transition from last screen
            else if (transitionIn)
            {
                switch (current.TransitionIn)
                {
                case TransitionType.Instant:
                    current.Draw(gametime, spriteBatch);
                    break;

                case TransitionType.Fade:
                    current.Draw(gametime, spriteBatch);
                    spriteBatch.Draw(onePixel, new Rectangle(0, 0, Constants.WINDOW_WIDTH, Constants.WINDOW_HEIGHT), Color.Black * transInVariable);
                    break;

                default:
                    break;
                }
            }
            // Update current Screen
            else
            {
                current.Draw(gametime, spriteBatch);
            }
        }