MCPcopy Create free account
hub / github.com/Berkeley-CS61B/skeleton-sp23 / drawFrame

Method drawFrame

lab13/src/MemoryGame/MemoryGame.java:64–89  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

62 }
63
64 public void drawFrame(String s) {
65 /* Take the input string S and display it at the center of the screen,
66 * with the pen settings given below. */
67 StdDraw.clear(Color.BLACK);
68 StdDraw.setPenColor(Color.WHITE);
69 Font fontBig = new Font("Monaco", Font.BOLD, 30);
70 StdDraw.setFont(fontBig);
71 StdDraw.text(this.width / 2, this.height / 2, s);
72
73 /* If the game is not over, display encouragement, and let the user know if they
74 * should be typing their answer or watching for the next round. */
75 if (!gameOver) {
76 Font fontSmall = new Font("Monaco", Font.BOLD, 20);
77 StdDraw.setFont(fontSmall);
78 StdDraw.line(0, this.height - 2, this.width, this.height - 2);
79 StdDraw.textLeft(0, this.height - 1, "Round: " + this.round);
80 if (this.playerTurn) {
81 StdDraw.text(this.width / 2, this.height - 1, "Type!");
82 } else {
83 StdDraw.text(this.width / 2, this.height - 1, "Watch!");
84 }
85 int randomEncouragement = RandomUtils.uniform(this.rand, ENCOURAGEMENT.length);
86 StdDraw.textRight(this.width, this.height - 1, ENCOURAGEMENT[randomEncouragement]);
87 }
88 StdDraw.show();
89 }
90
91 public void flashSequence(String letters) {
92 //TODO: Display each character in letters, making sure to blank the screen between letters

Callers 1

startGameMethod · 0.95

Calls 2

uniformMethod · 0.95
clearMethod · 0.65

Tested by

no test coverage detected