コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="spriteBatch"></param>
 public void Draw(SpriteBatch spriteBatch)
 {
     #region Paddles
     spriteBatch.Draw(P1.paddle.texture, destAsh, clsPlayer.sourceAsh, Color.White);
     spriteBatch.Draw(P2.paddle.texture, destGary, clsPlayer.sourceGary, Color.White);
     #endregion
     #region Barriers
     if (Game1.gameSettings.barriers == true)
     {
         botBarrier.Draw(spriteBatch);
         topBarrier.Draw(spriteBatch);
     }
     #endregion
     #region Game Ball
     gameBall.Draw(spriteBatch);
     #endregion
     #region PowerUps
     if (Game1.gameSettings.powerUps == true)
     {
         if (ballSpeedUp.active)
         {
             ballSpeedUp.Draw(spriteBatch);
         }
         if (ballSpeedDown.active)
         {
             ballSpeedDown.Draw(spriteBatch);
         }
         if (barrierSpeedUp.active && Game1.gameSettings.barriers)
         {
             barrierSpeedUp.Draw(spriteBatch);
         }
         if (barrierSpeedDown.active && Game1.gameSettings.barriers)
         {
             barrierSpeedDown.Draw(spriteBatch);
         }
     }
     #endregion
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: danielcahoon/IWKS3400_Lab4
        /// <summary>
        /// This draws out the Main Menu, Pause Screen, Single Player
        /// game, Two Player game, the associated parts to each of the
        /// games, the settings screen, and credits depending on the
        /// GameState.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            switch (CurrentGameState)
            {
                #region Main Menu
            case GameState.MainMenu:
                spriteBatch.Begin();
                MainMenuSprite.Draw(spriteBatch);
                mainMenu1P.Draw(spriteBatch);
                mainMenu2P.Draw(spriteBatch);
                mainMenuSettings.Draw(spriteBatch);
                mainMenuCredits.Draw(spriteBatch);
                mainMenuQuit.Draw(spriteBatch);
                spriteBatch.End();
                //*/

                //If I want to make there be a highlighting box
                //Make sure to change the MenuLineBar.bmp so that
                //It is just one color

                /*
                 * mainMenu1P.Draw(spriteBatch);
                 * mainMenu2P.Draw(spriteBatch);
                 * mainMenuSettings.Draw(spriteBatch);
                 * mainMenuCredits.Draw(spriteBatch);
                 * mainMenuQuit.Draw(spriteBatch);
                 * MainMenuSprite.Draw(spriteBatch);
                 * //*/

                break;

                #endregion
                #region Single Player Instructions
            case GameState.Instructions1P:
                spriteBatch.Begin();
                if (gameSettings.barriers && gameSettings.powerUps)
                {
                    pauseScreen1P_All.Draw(spriteBatch);
                }
                else if (gameSettings.powerUps)
                {
                    pauseScreen1P_Ball.Draw(spriteBatch);
                }
                else
                {
                    pauseScreen1P.Draw(spriteBatch);
                }
                spriteBatch.End();
                break;

                #endregion
                #region Single Player Game
            case GameState.InGame1P:
                spriteBatch.Begin();
                gymSprite.Draw(spriteBatch);
                P1Game.Draw(spriteBatch);
                spriteBatch.DrawString(Font1, "Gary: " + P1Game.P2.score, new Vector2(130, 60), Color.Black);
                spriteBatch.DrawString(Font1, "Ash: " + P1Game.P1.score, new Vector2(997, 60), Color.Black);
                spriteBatch.End();
                break;

                #endregion
                #region Single Player Pause
            case GameState.Pause1P:
                spriteBatch.Begin();
                pauseScreen.Draw(spriteBatch);
                pauseExitButton.Draw(spriteBatch);
                gameExitButton.Draw(spriteBatch);
                spriteBatch.End();
                break;

                #endregion
                #region Single Player End Game
            case GameState.GameEnd1P:
                spriteBatch.Begin();
                if (P1Game.P1.score > P1Game.P2.score)
                {
                    ashWin.Draw(spriteBatch);
                    spriteBatch.DrawString(Font1, P1Game.P1.score + " - " + P1Game.P2.score, new Vector2(600, 300), Color.Black);
                }
                else
                {
                    garyWin.Draw(spriteBatch);
                    spriteBatch.DrawString(Font1, P1Game.P2.score + " - " + P1Game.P1.score, new Vector2(550, 300), Color.Black);
                }
                spriteBatch.End();
                break;

                #endregion
                #region Two Player Instructions
            case GameState.Instructions2P:
                spriteBatch.Begin();
                if (gameSettings.barriers && gameSettings.powerUps)
                {
                    pauseScreen2P_All.Draw(spriteBatch);
                }
                else if (gameSettings.powerUps)
                {
                    pauseScreen2P_Ball.Draw(spriteBatch);
                }
                else
                {
                    pauseScreen2P.Draw(spriteBatch);
                }
                spriteBatch.End();
                break;

                #endregion
                #region Two Player Game
            case GameState.InGame2P:
                spriteBatch.Begin();
                gymSprite.Draw(spriteBatch);
                P2Game.Draw(spriteBatch);
                spriteBatch.DrawString(Font1, "Gary: " + P2Game.P2.score, new Vector2(130, 60), Color.Black);
                spriteBatch.DrawString(Font1, "Ash: " + P2Game.P1.score, new Vector2(997, 60), Color.Black);
                spriteBatch.End();
                break;

                #endregion
                #region Two Player Pause
            case GameState.Pause2P:
                spriteBatch.Begin();
                pauseScreen.Draw(spriteBatch);
                pauseExitButton.Draw(spriteBatch);
                gameExitButton.Draw(spriteBatch);
                spriteBatch.End();
                break;

                #endregion
                #region Two Player End Game
            case GameState.GameEnd2P:
                spriteBatch.Begin();
                if (P2Game.P1.score > P2Game.P2.score)
                {
                    ashWin.Draw(spriteBatch);
                    spriteBatch.DrawString(Font1, P2Game.P1.score + " - " + P2Game.P2.score, new Vector2(600, 300), Color.Black);
                }
                else
                {
                    garyWin.Draw(spriteBatch);
                    spriteBatch.DrawString(Font1, P2Game.P2.score + " - " + P2Game.P1.score, new Vector2(550, 300), Color.Black);
                }
                spriteBatch.End();
                break;

                #endregion
                #region Settings
            case GameState.Settings:
                spriteBatch.Begin();
                settingsSprite.Draw(spriteBatch);
                settingBarrierOn.Draw(spriteBatch);
                settingBarrierOff.Draw(spriteBatch);
                settingPowerUpsOn.Draw(spriteBatch);
                settingPowerUpsOff.Draw(spriteBatch);
                settingDifficulty1.Draw(spriteBatch);
                settingDifficulty2.Draw(spriteBatch);
                settingDifficulty3.Draw(spriteBatch);
                settingMusicOn.Draw(spriteBatch);
                settingMusicOff.Draw(spriteBatch);
                settingExitButton.Draw(spriteBatch);
                spriteBatch.End();
                break;

                #endregion
                #region Credits
            case GameState.Credits:
                spriteBatch.Begin();
                //spriteBatch.DrawString(Font1, "Credits\n     Danny Cahoon\n\n     Jacob Jolly\n\n     Hugh Ohlin\n\n     Robbie Fikes\n\n", new Vector2(((graphics.GraphicsDevice.Viewport.Width / 2) - Font1.MeasureString("Credits").X - 10), 10), Color.LimeGreen);
                //spriteBatch.DrawString(Font1, "Go Back. . . ", new Vector2(5, graphics.GraphicsDevice.Viewport.Height - Font1.MeasureString("Go Back. . .").Y), Color.LimeGreen);
                creditScreen.Draw(spriteBatch);
                spriteBatch.End();
                break;
                #endregion
            }
            base.Draw(gameTime);
        }
コード例 #3
0
 public void Draw(SpriteBatch spriteBatch)
 {
     paddle.Draw(spriteBatch);
 }