diff options
-rwxr-xr-x | cameltris.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cameltris.py b/cameltris.py index ea97fd5..fc9672f 100755 --- a/cameltris.py +++ b/cameltris.py @@ -1,15 +1,34 @@ #!/usr/bin/env python3 +import sys +import time + import pygame +def refresh_screen(): + for row_idx, row in enumerate(grid): + for col_idx, element in enumerate(row): + if element is not None: + screen.blit(white_piece, (col_idx * 50 + 1, row_idx * 50 + 1)) + pygame.init() +black = (0, 0, 0) +white = (0xff, 0xff, 0xff) + +white_piece = pygame.Surface((48, 48)) +white_piece.fill(white) + screen = pygame.display.set_mode((500, 1000)) +grid = [[True for _ in range(10)] for _ in range(20)] + while True: for event in pygame.event.get(): if event.type == pygame.QUIT: - break + sys.exit() - pygame.display.flip() + time.sleep(.1) + refresh_screen() + pygame.display.flip() |