-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (27 loc) · 812 Bytes
/
main.py
File metadata and controls
44 lines (27 loc) · 812 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
39
40
41
42
43
import pygame
from Chess.pieces import *
from Chess.cvars import *
def get_mouse_pos(mp):
x, y = mp[0], mp[1]
row = y // SQ_SIZE
col = x // SQ_SIZE
return (row, col)
def main():
run = True
clock = pygame.time.Clock()
while run == True:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.MOUSEBUTTONDOWN:
if game.checkmate == True or game.stalemate == True:
pygame.quit()
else:
mp = pygame.mouse.get_pos()
mos_pos = get_mouse_pos(mp)
game.click(mos_pos)
game.update()
pygame.quit()
game = Board()
main()