Browse Source

refactoring:

main
fdai4616 2 years ago
parent
commit
b1f1a95ae2
  1. 6
      src/main/java/PingPong/Score.java

6
src/main/java/PingPong/Score.java

@ -18,7 +18,7 @@ public class Score extends Rectangle {
public void draw(Graphics g) { public void draw(Graphics g) {
ScoreColor(g); ScoreColor(g);
g.setFont(new Font("Consolas", Font.BOLD,50)); g.setFont(new Font("Consolas", Font.BOLD,50));
g.drawLine(FRAME_WIDTH/2, 0, FRAME_WIDTH/2, FRAME_HEIGHT);
drawScoreLine(g);
g.drawOval((FRAME_WIDTH/2)-(COURT_CIRCLE/2), (FRAME_HEIGHT/2) - (COURT_CIRCLE/2), COURT_CIRCLE,COURT_CIRCLE); g.drawOval((FRAME_WIDTH/2)-(COURT_CIRCLE/2), (FRAME_HEIGHT/2) - (COURT_CIRCLE/2), COURT_CIRCLE,COURT_CIRCLE);
g.fillOval((FRAME_WIDTH/2)-(CENTER_DOT/2), (FRAME_HEIGHT/2) - (CENTER_DOT/2), CENTER_DOT,CENTER_DOT); g.fillOval((FRAME_WIDTH/2)-(CENTER_DOT/2), (FRAME_HEIGHT/2) - (CENTER_DOT/2), CENTER_DOT,CENTER_DOT);
g.drawString(String.valueOf(player_1/10) + String.valueOf(player_1%10), (FRAME_WIDTH/2)- 75, 50); g.drawString(String.valueOf(player_1/10) + String.valueOf(player_1%10), (FRAME_WIDTH/2)- 75, 50);
@ -26,6 +26,10 @@ public class Score extends Rectangle {
} }
private static void drawScoreLine(Graphics g) {
g.drawLine(FRAME_WIDTH/2, 0, FRAME_WIDTH/2, FRAME_HEIGHT);
}
private static void ScoreColor(Graphics g) { private static void ScoreColor(Graphics g) {
g.setColor(Color.white); g.setColor(Color.white);
} }

Loading…
Cancel
Save