Пример #1
0
 public void Draw(SpriteBatch spriteBatch)
 {
     Score.Draw(spriteBatch);
     PlayerPaddle.Draw(spriteBatch);
     ComputerPaddle.Draw(spriteBatch);
     Ball.Draw(spriteBatch);
 }
Пример #2
0
 public void Draw(SpriteBatch spriteBatch)
 {
     playerLeft.Draw(spriteBatch);
     playerRight.Draw(spriteBatch);
     Score.Draw(spriteBatch);
     Ball.Draw(spriteBatch);
 }
Пример #3
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            if (gameUpdating)
            {
                UpdatePlayerPaddle();
                UpdateCPUPaddle();

                UpdateScoreLabels();

                ball.Update();

                CheckBallWallCollision();
                CheckBallPlayerCollision();

                menuStrip1.Update();
            }

            Brush dottedSeparatorBrush = new SolidBrush(Color.White);
            Pen   dottedSeparatorPen   = new Pen(dottedSeparatorBrush);

            dottedSeparatorPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            e.Graphics.DrawLine(dottedSeparatorPen, new Point(0, FORM_HEIGHT / 2), new Point(FORM_WIDTH, FORM_HEIGHT / 2));

            playerPaddle.Draw(e.Graphics);
            cpuPaddle.Draw(e.Graphics);
            ball.Draw(e.Graphics);

            Invalidate();
        }
Пример #4
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here

            spriteBatch.Begin();

            spriteBatch.Draw(Background, screenRect, Color.White);

            for (int x = 0; x < players.Length; x++)
            {
                players[x].Draw(spriteBatch);
            }

            //player.Draw(spriteBatch);
            //player2.Draw(spriteBatch);
            //player3.Draw(spriteBatch);
            //player4.Draw(spriteBatch);

            ball.Draw(spriteBatch);

            spriteBatch.DrawString(ScoreFontP1, "P2 Score: " + ball.Player1Score, new Vector2(30, 10), Color.Blue);
            spriteBatch.DrawString(ScoreFontP2, "P2 Score: " + ball.Player2Score, new Vector2(screenRect.Width - 150, 10), Color.Red);



            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #5
0
        public void Draw(RenderContext context)
        {
            context.DrawTexture(
                Assets.Stretchy,
                new Vector2(
                    Size.Width / 2f - Assets.Stretchy.VirtualResolution !.Value.Width / 2f,
                    -12
                    ),
                Vector2.One,
                Vector2.Zero,
                0
                );

            var scoreStr  = $"{LeftScore}  {RightScore}";
            var scoreSize = Assets.ScoreFont.Measure(scoreStr);

            context.DrawString(
                Assets.ScoreFont,
                scoreStr,
                Size.Width / 2f - scoreSize.Width / 2f,
                Size.Height / 2f - scoreSize.Height / 2f,
                Color.White
                );

            _leftPaddle.Draw(context);
            _rightPaddle.Draw(context);
            _ball.Draw(context);
        }
Пример #6
0
 private void InitialDraw()
 {
     _player1.Draw();
     _player2.Draw();
     _ball.Draw();
     DrawScoreboard();
 }
Пример #7
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // Update camera View and Projection.
            var vp = GraphicsDevice.Viewport;

            spriteBatchEffect.View =
                Matrix.CreateLookAt(cameraPosition, cameraPosition + Vector3.Forward, Vector3.Up);
            spriteBatchEffect.Projection =
                Matrix.CreateOrthographic(CameraViewWidth, CameraViewWidth / vp.AspectRatio, 0f, -1f);

            // Draw player and ground.
            // Our View/Projection requires RasterizerState.CullClockwise and SpriteEffects.FlipVertically.
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullClockwise,
                              spriteBatchEffect);

            ball.Draw(spriteBatch);
            cage.Draw(spriteBatch);

            leftPlayer.Draw(spriteBatch);
            rightPlayer.Draw(spriteBatch);

            var textureOrigin = new Vector2(font.Texture.Width, font.Texture.Height) / 2f;

            spriteBatch.DrawString(font, "Player 1: " + leftPlayer.Score, new Vector2(-7, 6.5f), Color.Indigo, 0,
                                   textureOrigin, new Vector2(0.02f), SpriteEffects.FlipVertically, 1);
            spriteBatch.DrawString(font, "Player 2: " + rightPlayer.Score, new Vector2(8f, 6.5f), Color.DarkRed, 0,
                                   textureOrigin, new Vector2(0.02f), SpriteEffects.FlipVertically, 1);

            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #8
0
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Draw(GameTime gameTime)
 {
     GraphicsDevice.Clear(Color.Black); //replace previous image with background colors
     spriteBatch.Begin();
     base.Draw(gameTime);
     if (startup == true)
     {
         spriteBatch.DrawString(font, "Welcome to Pong! \nPress Space to Start.", new Vector2(300, 200), Color.White);
     }
     if (RedWins)
     {
         spriteBatch.DrawString(font, "           Red WINS! \n Press Space to play again", new Vector2(300, 200), Color.White);
     }
     if (BlueWins)
     {
         spriteBatch.DrawString(font, "           Blue WINS!\n Press Space to play again", new Vector2(300, 200), Color.White);
     }
     if (title == false)
     {
         LivesHandeler.DrawLives(Game.LivesRight, "Right", spriteBatch);
         LivesHandeler.DrawLives(Game.LivesLeft, "Left", spriteBatch);
         //Draw the items with their draw functions
         PlatformLeft.Draw(spriteBatch);
         PlatformRight.Draw(spriteBatch);
         PongBall.Draw(spriteBatch);
         spriteBatch.DrawString(font, "Score:" + ScoreLeft.ToString(), new Vector2(20, SchreenHeight - 20), Color.White);
         spriteBatch.DrawString(font, "Score:" + ScoreRight.ToString(), new Vector2(SchreenWith - 80, SchreenHeight - 20), Color.White);
     }
     spriteBatch.End();
 }
Пример #9
0
Файл: Game1.cs Проект: ayrc/Pong
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            // Draw score
            string title = "Score";

            // Find the center of the string
            Vector2 FontOrigin = score.MeasureString(title) / 2;

            // Draw the string (this one uses 10 args...)
            spriteBatch.DrawString(score, title, fontPos, Color.WhiteSmoke, 0, FontOrigin, 1.0f, SpriteEffects.FlipHorizontally, 0.5f);
            string lScore = "Left: " + rightCount;

            FontOrigin = leftScore.MeasureString(lScore) / 2;
            spriteBatch.DrawString(leftScore, lScore, lPos, Color.Purple, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
            string rScore = "Right: " + leftCount;

            FontOrigin = rightScore.MeasureString(rScore) / 2;
            spriteBatch.DrawString(rightScore, rScore, rPos, Color.Green, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);

            left.Draw(this.spriteBatch);
            right.Draw(this.spriteBatch);
            mBall.Draw(this.spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #10
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin();
            spriteBatch.Draw(background, field, Color.White);
            if (state == GameState.Started || state == GameState.CountDown)
            {
                for (int i = 0; i < players.Length; i++)
                {
                    players[i].Draw(spriteBatch);
                }

                ball.Draw(spriteBatch);

                if (state == GameState.CountDown)
                {
                    countdown.Draw(spriteBatch);
                }

                DrawScore();
            }
            else
            {
                DrawText();
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
Пример #11
0
 public void Run()
 {
     ball.Move();
     ball.Bounce();
     ball.Draw();
     CheckForScore();
     paddle.Draw();
 }
Пример #12
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            playerPaddle.Draw(spriteBatch);
            computerPaddle.Draw(spriteBatch);
            ball.Draw(spriteBatch);
            score.Draw(spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #13
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            player.Draw();
            enemySprite.Draw();
            ball.Draw();
            WriteDebugInformation();
            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #14
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            paddleOne.Draw(spriteBatch);
            paddleTwo.Draw(spriteBatch);
            ball.Draw(spriteBatch);

            spriteBatch.End();
            base.Draw(gameTime);
        }
Пример #15
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            Player.Draw(spriteBatch);
            Ball.Draw(spriteBatch);
            foreach (var b in Blocks)
            {
                b.Draw(spriteBatch);
            }
            spriteBatch.End();
            // TODO: Add your drawing code here
            base.Draw(gameTime);
        }
Пример #16
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            spriteBatch.Draw(background, bckgrndRectangle, Color.White);
            ball.Draw(spriteBatch);
            padLeft.Draw(spriteBatch);
            padRight.Draw(spriteBatch);
            DrawTexts(spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #17
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            Joueur1.Draw(spriteBatch);
            Joueur2.Draw(spriteBatch);
            Ball.Draw(spriteBatch);
            Basique.DrawLatence(spriteBatch, Latence, font, fontOrigin);

            if (!IsReady)
            {
                Basique.DrawMessage(spriteBatch, font, fontOrigin, gameTime, Text);
            }

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Пример #18
0
        public void Draw(SpriteBatch b)
        {
            b.Draw(squareTexture, new Rectangle(0, 0, GetScreenWidth(), GetScreenWidth()), null, Color.Black);
            if (started || starting)
            {
                foreach (INonReactiveCollideable collideable in nonReactiveCollideables)
                {
                    collideable.Draw(b);
                }
                ball.Draw(b);
                scoreDisplay.Draw(b);

                if (paused)
                {
                    SpriteText.drawStringHorizontallyCenteredAt(b, "Press P to resume", GetScreenWidth() / 2, GetScreenHeight() / 2, 999999, -1, 999999, 1f, 0.88f, false, SpriteText.color_White);
                }
                else if (starting)
                {
                    SpriteText.drawStringHorizontallyCenteredAt(b, $"{(startTimer < 60 ? 1 : (startTimer < 120 ? 2 : 3))}", GetScreenWidth() / 2, (int)(GetScreenHeight() / 2 - Game1.tileSize * 1.5), 999999, -1, 999999, 1f, 0.88f, false, SpriteText.color_White);
                }
                else
                {
                    SpriteText.drawString(b, "P to pause", 50, 150, 999999, -1, 999999, 1f, 0.88f, false, -1, "", SpriteText.color_White);
                }

                if (!starting)
                {
                    SpriteText.drawString(b, "Esc to exit", 50, 100, 999999, -1, 999999, 1f, 0.88f, false, -1, "", SpriteText.color_White);
                }
            }
            else
            {
                int centerHeight = SpriteText.getHeightOfString("Press Space to start");
                SpriteText.drawStringHorizontallyCenteredAt(b, "Pong", GetScreenWidth() / 2, GetScreenHeight() / 2 - centerHeight * 5, 999999, -1, 999999, 1f, 0.88f, false, SpriteText.color_White);
                SpriteText.drawStringHorizontallyCenteredAt(b, "By Cat", GetScreenWidth() / 2, GetScreenHeight() / 2 - centerHeight * 4, 999999, -1, 999999, 1f, 0.88f, false, SpriteText.color_White);

                SpriteText.drawStringHorizontallyCenteredAt(b, "Press Space to start", GetScreenWidth() / 2, GetScreenHeight() / 2, 999999, -1, 999999, 1f, 0.88f, false, SpriteText.color_White);
                int escHeight = SpriteText.getHeightOfString("Press Esc to exit");
                SpriteText.drawString(b, "Press Esc to exit", 0, GetScreenHeight() - escHeight, 999999, -1, 999999, 1f, 0.88f, false, -1, "", SpriteText.color_White);
            }
            b.Draw(Game1.mouseCursors, new Rectangle(Game1.oldMouseState.X, Game1.oldMouseState.Y, Game1.tileSize / 2, Game1.tileSize / 2), new Rectangle(146, 384, 9, 9), Color.White);
        }
Пример #19
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Gray);

            spriteBatch.Begin();

            // Draw GameObjects
            paddleOne.Draw(spriteBatch);
            paddleTwo.Draw(spriteBatch);
            ball.Draw(spriteBatch);

            // Write score
            string score = paddleOne.Score + ":" + paddleTwo.Score;

            spriteBatch.DrawString(defaultFont, score, new Vector2((GraphicsDevice.Viewport.Width / 2) - (defaultFont.MeasureString(score).X / 2), 0), Color.Black);

            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #20
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);


            switch (currentGameState)
            {
            case GameState.Menu:
                spriteBatch.Begin();
                spriteBatch.DrawString(font, "Basic Pong", new Vector2(250, 0), Color.Red);
                spriteBatch.End();
                break;

            case GameState.Game:
                spriteBatch.Begin();
                //double time = gameTime.ElapsedGameTime.TotalSeconds;
                spriteBatch.Draw(background, new Rectangle(0, 0, 800, 480), Color.Gray);
                spriteBatch.DrawString(font, (playerScore.X.ToString()), new Vector2(200, 0), Color.White);
                spriteBatch.DrawString(font, (playerScore.Y.ToString()), new Vector2(500, 0), Color.White);
                spriteBatch.End();
                ball.Draw(spriteBatch);
                player1.Draw(spriteBatch);
                player2.Draw(spriteBatch);
                break;


            case GameState.Paused:
                spriteBatch.DrawString(font, "This is paused", new Vector2(200, 0), Color.White);
                spriteBatch.End();
                break;
            }



            base.Draw(gameTime);
        }
Пример #21
0
        /// <summary>
        /// Här ritas alla textures ut vid olika tidpunkter. Först ritas menyskärmen ut, spelet kollar ifall den är false så ritas loading screenen ut.
        /// Efter 5 sekunder ritas själva spelet ut. Draw metoden i main tar metoder från de andra klasserna, alltså ritas iget ut direkt ifrån main.
        /// Penga regnet loopas bara igenom här och ritar ut alla mynt som finns i listan, det är update som rör på mynten.
        /// </summary>

        //Här ritas all spelgrafik ut
        #region Draw metod för main
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);

            spriteBatch.Begin();

            menuScreen.Draw(spriteBatch);

            //Ritar ut alla väljbara bakgrunder ifall menyskärmen är aktiv
            #region
            if (menuScreen.GameState == true)
            {
                menuScreen.Draw(spriteBatch);

                //Ritar ut alla mynt som finns i listan
                for (int i = 0; i < coins.Count; i++)
                {
                    coins[i].Draw(spriteBatch);
                }

                backGround1.Draw(spriteBatch);

                backGround2.Draw(spriteBatch);

                backGround3.Draw(spriteBatch);

                backGround4.Draw(spriteBatch);

                backGround5.Draw(spriteBatch);

                backGroundFont.Draw2(spriteBatch);
            }
            #endregion

            //Ritar ut loading screen i 5 sekunder
            if (globalTimer > 0 && globalTimer < 5)
            {
                backGroundFont2.Draw3(spriteBatch);
            }

            //Ifall menyskärmen inte visas och ifall blobala timern är större än 5, gör följande
            if (menuScreen.GameState == false && globalTimer > 5)
            {
                //Ifall intersect är ett nummer från 1 till 5, rita ut respektive nummers bakgrundsbild
                #region
                if (backGround1.Intersect)
                {
                    backGround1.Draw4(spriteBatch);
                }

                if (backGround2.Intersect)
                {
                    backGround2.Draw4(spriteBatch);
                }

                if (backGround3.Intersect)
                {
                    backGround3.Draw4(spriteBatch);
                }

                if (backGround4.Intersect)
                {
                    backGround4.Draw4(spriteBatch);
                }

                if (backGround5.Intersect)
                {
                    backGround5.Draw4(spriteBatch);
                }
                #endregion

                //Ritar ut paddlar, boll och bonus
                #region
                rightPaddle.Draw(spriteBatch);
                leftPaddle.Draw(spriteBatch);

                ball1.Draw(spriteBatch);

                score1.Draw(spriteBatch, Window);

                box.Draw(spriteBatch);
                #endregion
            }

            spriteBatch.End();

            // TODO: Add your drawing code here.

            base.Draw(gameTime);
        }
Пример #22
0
        private void MainLoop(object sender, EventArgs e)
        {
            /* Clears the Screen */
            CreateGraphics().FillRectangle(new SolidBrush(Color.Black), 0, 0, 800, 600);
            pongBall.Draw(this.CreateGraphics());
            right.Draw(this.CreateGraphics());
            left.Draw(CreateGraphics());
            pongBall.calculate();
            if (pongBall.getX() <= 0)
            {
                left.setPoints(left.getPoints() + 1);
                if (left.getPoints() >= numberOfPointsToWin)
                {
                    CreateGraphics().FillRectangle(new SolidBrush(Color.Black), 0, 0, 800, 600);

                    CreateGraphics().DrawString("Right WINS!", new Font("Arial", 72), new SolidBrush(Color.White), new PointF(100, 100));
                    t.Enabled = false;
                }
                right.setX(770);
                right.setY(250);
                left.setX(30);
                left.setY(250);
                pongBall.setX(400);
                pongBall.setY(300);
                pongBall.setXVelocity((int)(randomObject.Next(4, pongBall.getMaxSpeed() * 2) - pongBall.getMaxSpeed()));
                pongBall.setYVelocity((int)(randomObject.Next(4, pongBall.getMaxSpeed() * 2) - pongBall.getMaxSpeed()));
            }

            if (pongBall.getX() >= 800)
            {
                right.setPoints(right.getPoints() + 1);
                if (right.getPoints() >= numberOfPointsToWin)
                {
                    CreateGraphics().FillRectangle(new SolidBrush(Color.Black), 0, 0, 800, 600);

                    CreateGraphics().DrawString("LEFT WINS!", new Font("Arial", 72), new SolidBrush(Color.White), new PointF(90, 100));
                    t.Enabled = false;
                    return;
                }
                right.setX(770);
                right.setY(250);
                left.setX(30);
                left.setY(250);
                pongBall.setX(400);
                pongBall.setY(300);
                pongBall.setXVelocity((int)(randomObject.Next(4, pongBall.getMaxSpeed() * 2) - pongBall.getMaxSpeed()));
                pongBall.setYVelocity((int)(randomObject.Next(4, pongBall.getMaxSpeed() * 2) - pongBall.getMaxSpeed()));
            }
            if (pongBall.getY() >= 600)
            {
                pongBall.setYVelocity(-pongBall.getYVelocity());
            }
            if (pongBall.getY() <= 0)
            {
                pongBall.setYVelocity(-pongBall.getYVelocity());
            }

            if (pongBall.getX() <= left.getX() + left.getWidth() && pongBall.getX() >= left.getX())
            {
                if (pongBall.getY() <= left.getY() + left.getHeight() && pongBall.getY() >= left.getY())
                {
                    pongBall.setXVelocity(-pongBall.getXVelocity());
                }
            }
            if (pongBall.getX() <= right.getX() + right.getWidth() && pongBall.getX() >= right.getX())
            {
                if (pongBall.getY() <= right.getY() + right.getHeight() && pongBall.getY() >= right.getY())
                {
                    pongBall.setXVelocity(-pongBall.getXVelocity());
                }
            }
            CreateGraphics().DrawString(right.getPoints() + "", new Font("Arial", 72), new SolidBrush(Color.White), new PointF(100, 100));
            CreateGraphics().DrawString(left.getPoints() + "", new Font("Arial", 72), new SolidBrush(Color.White), new PointF(600, 100));
            Console.WriteLine("Pong Ball Position - X: " + pongBall.getX() + " Y: " + pongBall.getY());
            Console.WriteLine("Paddle Left Position - X: " + left.getX() + " Y: " + left.getY());
            if (right.getPoints() >= numberOfPointsToWin)
            {
                CreateGraphics().FillRectangle(new SolidBrush(Color.Black), 0, 0, 800, 600);

                CreateGraphics().DrawString("LEFT WINS!", new Font("Arial", 72), new SolidBrush(Color.White), new PointF(90, 100));
                t.Enabled = false;
                return;
            }
            if (left.getPoints() >= numberOfPointsToWin)
            {
                CreateGraphics().FillRectangle(new SolidBrush(Color.Black), 0, 0, 800, 600);

                CreateGraphics().DrawString("Right WINS!", new Font("Arial", 72), new SolidBrush(Color.White), new PointF(100, 100));
                t.Enabled = false;
                return;
            }
        }
Пример #23
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            if (theme == Theme.Green)
            {
                GraphicsDevice.Clear(Color.DarkOliveGreen);
            }
            if (theme == Theme.Black)
            {
                GraphicsDevice.Clear(Color.Black);
            }
            if (theme == Theme.Pink)
            {
                GraphicsDevice.Clear(Color.HotPink);
            }
            if (theme == Theme.Rave)
            {
                Color background;
                background = new Color(x, y, z);
                GraphicsDevice.Clear(background);
            }
            if (theme == Theme.Changing)
            {
                Color background;
                background = new Color(a, b, c);
                GraphicsDevice.Clear(background);
                if (ball.Boundary.Intersects(player2.Boundary) || ball.Boundary.Intersects(player1.Boundary) || ball.Boundary.Top <= 0 || ball.Boundary.Bottom >= vWindowSize.Y)
                {
                    change = 1;
                }
                else
                {
                    change = 0;
                }
            }
            int points1 = ball.points1;
            int points2 = ball.points2;



            // TODO: Add your drawing code here
            //if (gameState == GameState.Menu)
            switch (gameState)
            {
            case GameState.Menu:
                string  sTitle    = "PONG";
                Vector2 vTitle    = fTitle.MeasureString(sTitle);
                Vector2 tCenter   = new Vector2((float)(vWindowSize.X - vTitle.X) / 2, (float)50);
                string  sMainMenu = "Press Enter to begin game!\nPress I for instructions\nPress S for settings\nPress ESC to Exit";
                Vector2 vMainMenu = fText.MeasureString(sMainMenu);
                Vector2 vCentre   = (vWindowSize - vMainMenu) / 2;
                //Draw the Main Menu on the screen
                spriteBatch.Begin();
                spriteBatch.DrawString(fTitle, sTitle, tCenter, Color.PeachPuff);
                spriteBatch.DrawString(fText, sMainMenu, vCentre, Color.PeachPuff);
                spriteBatch.End();
                break;

            case GameState.Play:
                spriteBatch.Begin();
                player1.Draw(spriteBatch);
                player2.Draw(spriteBatch);
                string  sPoints2 = "" + points2;
                string  sPlayer1 = "Player 1";
                string  sPlayer2 = "Player 2";
                Vector2 vPoints2 = fText.MeasureString(sPoints2);
                Vector2 vPlayer1 = fText.MeasureString(sPlayer1);
                Vector2 vPlayer2 = fText.MeasureString(sPlayer2);

                ball.Draw(spriteBatch);
                spriteBatch.DrawString(fText, "" + points1, new Vector2(75, 30), Color.White);
                spriteBatch.DrawString(fText, sPoints2, new Vector2((float)vWindowSize.X - (75 + (float)vPoints2.X), 30), Color.White);
                spriteBatch.DrawString(fText, sPlayer1, new Vector2((75 - ((float)vPlayer1.X / 2)), 0), Color.White);
                spriteBatch.DrawString(fText, sPlayer2, new Vector2((float)vWindowSize.X - (75 + ((float)vPlayer2.X / 2)), 0), Color.White);
                spriteBatch.End();
                break;

            case GameState.Pause:
                sTitle  = "PONG";
                vTitle  = fTitle.MeasureString(sTitle);
                tCenter = new Vector2((float)(vWindowSize.X - vTitle.X) / 2, (float)50);
                string  sPauseMenu = "Press Enter to resume\nPress Escape to exit\n\nPress M to Return to the main menu\nPress R to restart";
                Vector2 vPauseMenu = fText.MeasureString(sPauseMenu);
                Vector2 pCentre    = (vWindowSize - vPauseMenu) / 2;
                //draw pause menu on screen
                spriteBatch.Begin();
                spriteBatch.DrawString(fTitle, sTitle, tCenter, Color.PeachPuff);
                spriteBatch.DrawString(fText, sPauseMenu, pCentre, Color.PeachPuff);
                spriteBatch.End();
                break;

            case GameState.GameOver:
                string  sGameOver       = "Press R to restart \n\nPress M to return to the main menu\n\nPress ESC to exit";
                string  sWinner1        = "Player 1 Wins!";
                string  sWinner2        = "Player 2 Wins!";
                string  sGameOverTitle  = "Game Over";
                Vector2 vGameOverTitle  = fTitle.MeasureString(sGameOverTitle);
                Vector2 tGameOverCenter = new Vector2((float)(vWindowSize.X - vGameOverTitle.X) / 2, (float)50);
                Vector2 vGameOver       = fText.MeasureString(sGameOver);
                Vector2 gCentre         = (vWindowSize - vGameOver) / 2;
                Vector2 vWinner         = fTitle.MeasureString(sWinner1);
                Vector2 wCenter         = new Vector2((float)(vWindowSize.X - vWinner.X) / 2, (float)100);
                spriteBatch.Begin();
                spriteBatch.DrawString(fTitle, sGameOverTitle, tGameOverCenter, Color.PeachPuff);
                spriteBatch.DrawString(fText, sGameOver, gCentre, Color.PeachPuff);
                if (ball.points2 == 10)
                {
                    spriteBatch.DrawString(fTitle, sWinner1, wCenter, Color.PeachPuff);
                }
                if (ball.points1 == 10)
                {
                    spriteBatch.DrawString(fTitle, sWinner2, wCenter, Color.PeachPuff);
                }
                spriteBatch.End();
                break;

            case GameState.Exit:
                string sExit = "Would you like to exit\nPress Y to exit and N to continue";
                sTitle  = "PONG";
                vTitle  = fTitle.MeasureString(sTitle);
                tCenter = new Vector2((float)(vWindowSize.X - vTitle.X) / 2, (float)50);
                Vector2 vExit   = fText.MeasureString(sExit);
                Vector2 cCentre = (vWindowSize - vExit) / 2;
                //draw exit menu on screen
                spriteBatch.Begin();
                spriteBatch.DrawString(fTitle, sTitle, tCenter, Color.PeachPuff);
                spriteBatch.DrawString(fText, sExit, cCentre, Color.PeachPuff);
                spriteBatch.End();
                break;

            case GameState.Instructions:
                sTitle  = "PONG";
                vTitle  = fTitle.MeasureString(sTitle);
                tCenter = new Vector2((float)(vWindowSize.X - vTitle.X) / 2, (float)50);
                string  sInstructions = "INSTRUCTIONS:\nUse the paddle to hit to ball to your opponent\nIf the ball goes past your paddle your opponent gets a point\nThe ball gets faster every time it hits a paddle\nThe first player to 10 points wins!\n\nCONTROLS:\nUse the W and S keys to move Player 1\nUse Up and Down to move Player 2\nPress P to pause the game\nPress ESC to exit the game\n\nPress M to return to the menu";
                Vector2 vInstructions = fInstructionMenu.MeasureString(sInstructions);
                Vector2 iCentre       = (vWindowSize - vInstructions) / 2;
                //draw instructions on screen
                spriteBatch.Begin();
                spriteBatch.DrawString(fTitle, sTitle, tCenter, Color.PeachPuff);
                spriteBatch.DrawString(fInstructionMenu, sInstructions, iCentre, Color.PeachPuff);
                spriteBatch.End();
                break;

            case GameState.Settings:
                sTitle  = "PONG";
                vTitle  = fTitle.MeasureString(sTitle);
                tCenter = new Vector2((float)(vWindowSize.X - vTitle.X) / 2, (float)50);
                string  sSettings = "Press E for easy and H for hard\nPress M to return to the menu\n\nPress P for Pink Theme\nPress B for Black Theme\nPress G for Green Theme\nPress R for Rave\nPress C for Chaning Colors";
                string  sEasy     = "EASY";
                string  sHard     = "HARD";
                Vector2 vEasy     = fTitle.MeasureString(sEasy);
                Vector2 vHard     = fTitle.MeasureString(sHard);
                Vector2 vSettings = fText.MeasureString(sSettings);
                Vector2 sCentre   = (vWindowSize - vSettings) / 2;
                //draw settings on screen
                spriteBatch.Begin();
                spriteBatch.DrawString(fTitle, sTitle, tCenter, Color.PeachPuff);
                spriteBatch.DrawString(fText, sSettings, sCentre, Color.PeachPuff);
                if (difficulty == Difficulty.Easy)
                {
                    spriteBatch.DrawString(fTitle, sEasy, new Vector2(20, (float)vWindowSize.Y - (float)vEasy.Y), Color.Yellow);
                    spriteBatch.DrawString(fTitle, sHard, new Vector2((float)vWindowSize.X - (float)vHard.X, (float)vWindowSize.Y - (float)vHard.Y), Color.PeachPuff);
                }
                if (difficulty == Difficulty.Hard)
                {
                    spriteBatch.DrawString(fTitle, sEasy, new Vector2(20, (float)vWindowSize.Y - (float)vEasy.Y), Color.PeachPuff);
                    spriteBatch.DrawString(fTitle, sHard, new Vector2((float)vWindowSize.X - (float)vHard.X, (float)vWindowSize.Y - (float)vHard.Y), Color.Yellow);
                }

                spriteBatch.End();
                break;
            }


            base.Draw(gameTime);
        }