-
Notifications
You must be signed in to change notification settings - Fork 0
/
brick_breaker.py
48 lines (35 loc) · 964 Bytes
/
brick_breaker.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
42
43
44
45
46
47
48
"""
Brickbreaker game
@author: pruvolo
"""
# By convention ( https://www.python.org/dev/peps/pep-0008/#imports )
# imports are grouped as:
# 1) standard library
import random
import math
import time
# 2) 3rd party libraries
import pygame
from pygame.locals import *
# 3) Local modules
from model.simple_model import Model
from view.pygame_window_view import View
from controller.keyboard_controller import Controller
#from controller.mouse_controller import Controller
if __name__ == '__main__':
pygame.init()
size = (640,480)
screen = pygame.display.set_mode(size)
model = Model(size)
view = View(screen, model)
controller = Controller(model)
running = True
while running:
for event in pygame.event.get():
if event.type == QUIT:
running = False
controller.handle_pygame_event(event)
model.update()
view.draw()
time.sleep(.001)
pygame.quit()