Exemple #1
0
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // This game has a blue background. Why? Because!
            ScreenManager.GraphicsDevice.Clear(Color.Black);

            // Our player and enemy are both actually just text strings.
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            //spriteBatch.Begin();
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);

            // Draw Duck Balls
            m_ball.Draw(spriteBatch);

            // Draw Paddles
            m_player1.Draw(spriteBatch);
            m_player2.Draw(spriteBatch);

            // Draw Scores
            spriteBatch.DrawString(m_score_fnt, m_player_1_score.ToString(), new Vector2(HelperUtils.SafeBoundary.X + 332 - m_score_fnt.MeasureString(m_player_1_score.ToString()).X, HelperUtils.SafeBoundary.Y + 100), Color.White);
            spriteBatch.DrawString(m_score_fnt, m_player_2_score.ToString(), new Vector2(HelperUtils.SafeBoundary.X + 844 - m_score_fnt.MeasureString(m_player_2_score.ToString()).X, HelperUtils.SafeBoundary.Y + 100), Color.White);

            int y = HelperUtils.SafeBoundary.Y + 3;

            for (int i = 0; i < 31; i++)
            {
                spriteBatch.Draw(ScreenTexture, new Rectangle((ScreenManager.GraphicsDevice.Viewport.Width / 2) - 1, y, 3, 10), Color.White);
                y += 20;
            }

            #if XBOX // Draw the WideScreen Lines (Top and bottom)
            //Top
            spriteBatch.Draw(ScreenTexture, new Rectangle(0, boxrec.Top - 63, 1024 + 2 * HelperUtils.SafeBoundary.X, 63), Color.White);
            //Bottom
            spriteBatch.Draw(ScreenTexture, new Rectangle(0, boxrec.Bottom, 1024 + 2 * HelperUtils.SafeBoundary.X, 63), Color.White);
            #endif

            spriteBatch.End();

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0 || pauseAlpha > 0)
            {
                float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

                ScreenManager.FadeBackBufferToBlack(alpha);
            }
        }
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // Our player and enemy are both actually just text strings.
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            //spriteBatch.Begin();
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);

            if (m_ducks.IntermissionScene == 0)
            {
                spriteBatch.Draw(ScreenTexture, HelperUtils.SafeBoundary, new Color(247, 206, 176, 255));
                //ScreenManager.GraphicsDevice.Clear(new Color(247, 206, 176, 255));
                m_fly_sign.Draw(spriteBatch);
            }
            else
            {
                spriteBatch.Draw(ScreenTexture, HelperUtils.SafeBoundary, new Color(49, 192, 250, 255));
                //ScreenManager.GraphicsDevice.Clear(new Color(49, 192, 250, 255));
            }

            // Draw tree
            spriteBatch.Draw(tree, new Vector2(HelperUtils.SafeBoundary.X + 122, HelperUtils.SafeBoundary.Y + 236), null, Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0);

            // Draw Bush
            spriteBatch.Draw(bush, new Vector2(HelperUtils.SafeBoundary.X + 822, HelperUtils.SafeBoundary.Y + 356), null, Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0);

            // Draw Duck Balls
            m_ducks.DrawBalls(spriteBatch);

            // Draw Intermission
            m_ducks.DrawIntermission(spriteBatch);

            // Draw left ground + grass
            spriteBatch.Draw(ground, new Vector2(HelperUtils.SafeBoundary.X, HelperUtils.SafeBoundary.Y + 436), null, Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0);

            // Draw right ground + grass
            spriteBatch.Draw(ground, new Vector2(HelperUtils.SafeBoundary.X + 512, HelperUtils.SafeBoundary.Y + 436), null, Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0);

            m_clouds_p1.Draw(spriteBatch);
            m_clouds_p2.Draw(spriteBatch);

            // Draw Paddles
            m_player1.DrawPaddle(spriteBatch);
            m_player2.DrawPaddle(spriteBatch);

            // Draw Intro
            m_intro.Draw(spriteBatch);
            m_ducks.DrawCounter(spriteBatch);


            m_player1.DrawItems(spriteBatch);
            m_player2.DrawItems(spriteBatch);


            /* Draw Shot */
            m_flash.Draw(spriteBatch);
            m_duck1_flash.Draw(spriteBatch);
            m_duck2_flash.Draw(spriteBatch);

            #if XBOX // Draw the WideScreen Lines (Top and bottom)
            //Top
            spriteBatch.Draw(ScreenTexture, new Rectangle(0, HelperUtils.SafeBoundary.Top - 63, 1024 + 2 * HelperUtils.SafeBoundary.X, 63), Color.Black);
            //Bottom
            spriteBatch.Draw(ScreenTexture, new Rectangle(0, HelperUtils.SafeBoundary.Bottom, 1024 + 2 * HelperUtils.SafeBoundary.X, 63), Color.Black);
            #endif

            // spriteBatch.Draw(ScreenTexture, m_background_color_rect, Color.PaleGoldenrod);

            //spriteBatch.Draw(ScreenTexture, boxrec, Color.Black); //new Color(0, 0, 0, 255));

            /*
             * // spriteBatch.Draw(ScreenTexture, startpos, Color.Beige);
             *
             *
             * spriteBatch.Draw(ScreenTexture, newbound[0], Color.Red);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[1], Color.Purple);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[2], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[3], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[4], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[5], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[6], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[7], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[8], Color.White);
             *
             * spriteBatch.Draw(ScreenTexture, newbound[9], Color.White);
             */

            spriteBatch.End();

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0 || pauseAlpha > 0)
            {
                float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

                ScreenManager.FadeBackBufferToBlack(alpha);
            }
        }