def drawNextPiece(self, stdscr): stdscr.addstr(0, 30, "Next Piece") self.drawBox(stdscr, 31, 1, 8, 8) if self.nextPiece is not None: self.nextPiece.draw(stdscr, 7, 34) else: Piece.drawBlank(stdscr, 3, 34)
def draw(self, stdscr, highlight=-1): for i in range(16): X = i % 4 Y = i // 4 if i < len(self.bag): self.bag[i].draw(stdscr, (Y + 1) * 5 + 1, (X + 10) * 5, [highlight // 4, highlight % 4] == [Y, X]) else: Piece.drawBlank(stdscr, (Y + 1) * 5 - 3, (X + 10) * 5, False)
def draw(self, stdscr, highlight=-1): for i in range(4): for j in range(4): Piece.drawBlank(stdscr, i * 5 + 2, (j + 1) * 5 - 1, [highlight // 4, highlight % 4] == [i, j]) if self.data[i][j] is not None: self.data[i][j].draw(stdscr, (i + 1) * 5 + 1, (j + 1) * 5 - 1, [highlight // 4, highlight % 4] == [i, j])