-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (30 loc) · 1013 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
### AUTHOR : Alban PERRIER - Bordeaux INP 2022
import sys, math
import pygame
import pygame.draw
from model.scene import Scene
MOUSE_LEFT = 1
MOUSE_MIDDLE = 2
MOUSE_RIGHT = 3
MOUSE_WHEEL_UP = 4
MOUSE_WHEEL_DOWN = 5
def main():
scene = Scene()
done = False
clock = pygame.time.Clock()
while done == False:
clock.tick(20)
scene.update()
scene.drawMe()
for event in pygame.event.get():
if event.type == pygame.QUIT: done=True
if event.type == pygame.KEYDOWN: done=True
if event.type == pygame.MOUSEWHEEL:
scene.recordVehiculeSize(event.y)
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == MOUSE_LEFT:
scene.eventClic(event.dict['pos'],event.dict['button'])
elif event.type == pygame.MOUSEMOTION:
scene.recordMouseMove(event.dict['pos'])
pygame.quit()
if not sys.flags.interactive: main()