-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (28 loc) · 972 Bytes
/
main.py
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
from consts import *
from screen import Screen
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
def main():
win = pygame.display.set_mode((WIDTH, HEIGHT))
screen = Screen(win)
clock = pygame.time.Clock()
run = True
while run:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
elif event.type == pygame.KEYDOWN:
screen.handle_key_down(event)
elif event.type == pygame.KEYUP:
screen.handle_key_up(event)
elif event.type == pygame.MOUSEBUTTONDOWN:
screen.handle_mouse_down(event)
elif event.type == pygame.MOUSEBUTTONUP:
screen.handle_mouse_up(event)
screen.update()
screen.draw()
if __name__ == "__main__":
main()