diff --git a/pydoku.py b/pydoku.py index 47f314f..8fd4acb 100644 --- a/pydoku.py +++ b/pydoku.py @@ -16,6 +16,7 @@ screen = pg.display.set_mode((900, 900)) pg.display.set_caption("Pydoku") pg.key.set_repeat(200, 35) title_font = pg.font.Font(None, 64) +filled_num_font = pg.font.Font(None, 48) clock = pg.time.Clock() running = True @@ -63,6 +64,24 @@ def draw_cursor(): CURSOR_SIZE, CURSOR_SIZE) screen.blit(cursorSurface, rect) +def get_num(row, col): + return board[row, col] + +filled_num_font = pg.font.Font(None, 60) +def draw_numbers(): + for row in range(9): + for col in range(9): + num = board[row * 9 + col] + if num == 0: + continue + digit = filled_num_font.render(str(num), True, "black") + pos = (GRID_X + CELL_SIZE * col + CELL_SIZE // 2 - digit.get_width() // 2, + # Here we divide the height by 2.3 because there seems to be some extra + # padding at the bottom of the surface + GRID_Y + CELL_SIZE * row + CELL_SIZE // 2 - digit.get_height() // 2.3) + + screen.blit(digit, pos) + title = title_font.render("Pydoku", True, "black") def draw_hud(): screen.blit(title, (screen.get_width() // 2 - title.get_width() // 2, 70)) @@ -97,6 +116,7 @@ while running: screen.fill('cornflower blue') draw_grid() + draw_numbers() draw_cursor() draw_hud()