示例#1
0
 protected override void Draw(GameTime gameTime)
 {
     GraphicsDevice.Clear(Color.Black);
     spriteBatch.Begin();
     if (mode == "Menu")
     {
         spriteBatch.DrawString(point, "Start", new Vector2(graphics.PreferredBackBufferWidth / 2 - 75, graphics.PreferredBackBufferHeight / 2 - 25), Color.White);
         spriteBatch.DrawString(point, "Exit", new Vector2(graphics.PreferredBackBufferWidth / 2 - 75, graphics.PreferredBackBufferHeight / 2 + 25), Color.White);
         if (menuStat == 1)
         {
             spriteBatch.DrawString(point, ">", new Vector2(graphics.PreferredBackBufferWidth / 2 - 100, graphics.PreferredBackBufferHeight / 2 - 25), Color.White);
         }
         else
         {
             spriteBatch.DrawString(point, ">", new Vector2(graphics.PreferredBackBufferWidth / 2 - 100, graphics.PreferredBackBufferHeight / 2 + 25), Color.White);
         }
     }
     if (mode == "Game")
     {
         spriteBatch.DrawString(point, " " + player1Point, new Vector2((Window.ClientBounds.Width / 2 - 75), 50), Color.White);
         spriteBatch.DrawString(point, " " + player2Point, new Vector2((Window.ClientBounds.Width / 2 + 25), 50), Color.White);
         spriteBatch.Draw(spriteBorder, new Rectangle(Window.ClientBounds.Width / 2 - spriteBorder.Width, 0, spriteBorder.Width, height), Color.White);
         spriteBatch.Draw(player1.sprite, player1.GetRec(), Color.Red);
         spriteBatch.Draw(player2.sprite, player2.GetRec(), Color.Blue);
         spriteBatch.Draw(ball.sprite, ball.GetRec(), Color.Yellow);
     }
     spriteBatch.End();
     base.Draw(gameTime);
 }