/// <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(); switch (CurrentGameState) { case GameState.MainMenu: //spriteBatch.Draw(Content.Load<Texture2D>("mainmenu"), new Rectangle(0, 0, screenWidth, screenHeight), Color.White); btnPlay.Draw(spriteBatch); btnExit.Draw(spriteBatch); break; case GameState.Playing: spriteBatch.Draw(gamebackground, new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), Color.White); player1.Draw(gameTime); player2.Draw(gameTime); spriteBatch.DrawString(font, score1 + " - " + score2, new Vector2(GraphicsDevice.Viewport.Width / 2 - font.MeasureString(score1 + " - " + score2).X / 2, 15), Color.Black); ball.Draw(gameTime); break; case GameState.GameOver: spriteBatch.DrawString(font, "winner is " + winner, new Vector2(GraphicsDevice.Viewport.Width / 2, 15), Color.Black); break; } spriteBatch.End(); base.Draw(gameTime); }
/// <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); spriteBatch.Begin(); player1.Draw(spriteBatch); player2.Draw(spriteBatch); ball.Draw(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
/// <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); _spriteBatch.Begin(); _playerPaddle.Draw(_spriteBatch); _ball.Draw(_spriteBatch); _computerPaddle.Draw(_spriteBatch); Score.Draw(_spriteBatch); _spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { spriteBatch.Begin(); GraphicsDevice.Clear(Color.White); // TODO: Add your drawing code here //spriteBatch.Draw(box, ball.Rectangle, Color.Red * 0.4f); ball.Draw(spriteBatch); spriteBatch.Draw(ball_shine, ball.Rectangle, Color.White); for (int i = 0; i < players.Length; ++i) { players[i].Draw(spriteBatch); //spriteBatch.Draw(box, players[i].Rectangle, Color.Red * 0.4f); spriteBatch.DrawString(scoreFont, players[i].Score_Str, players[i].Position - scoreFont.MeasureString(players[i].Score_Str) / 2, Color.Black); } foreach (var foo in intersections) { spriteBatch.Draw(box, foo, Color.Black * 0.1f); } wall_left.Draw(spriteBatch); wall_right.Draw(spriteBatch); foreach (var pu in powerups) { pu.Draw(spriteBatch); } spriteBatch.End(); base.Draw(gameTime); }