-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (26 loc) · 702 Bytes
/
main.py
File metadata and controls
38 lines (26 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pygame
from data.classes.Board import Board
pygame.init()
WINDOW_SIZE = (1000, 1000)
screen = pygame.display.set_mode(WINDOW_SIZE)
board = Board(WINDOW_SIZE[0], WINDOW_SIZE[1])
def draw(display):
display.fill('white')
board.draw(display)
pygame.display.update()
running = True
while running:
mx, my = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
board.handle_click(mx, my)
if board.is_in_checkmate('black'):
print('White wins!')
running = False
elif board.is_in_checkmate('white'):
print('Black wins!')
running = False
draw(screen)