| 18 | |
| 19 | |
| 20 | class PongPongWindow(pyglet.window.Window): |
| 21 | def __init__(self, *args, **kwargs): |
| 22 | super(PongPongWindow, self).__init__(*args, **kwargs) |
| 23 | |
| 24 | self.win_size = (WIDTH, HEIGHT) |
| 25 | self.paddle_pos = (WIDTH / 2 - PWIDTH / 2, 0) |
| 26 | self.main_batch = pyglet.graphics.Batch() |
| 27 | self.walls = load.load_rectangles(self.win_size, BORDER, batch=self.main_batch) |
| 28 | self.balls = load.load_balls( |
| 29 | self.win_size, RADIUS, speed=ballspeed, batch=self.main_batch |
| 30 | ) |
| 31 | self.paddles = load.load_paddles( |
| 32 | self.paddle_pos, PWIDTH, PHEIGHT, acc=paddleacc, batch=self.main_batch |
| 33 | ) |
| 34 | |
| 35 | def on_draw(self): |
| 36 | self.clear() |
| 37 | self.main_batch.draw() |
| 38 | |
| 39 | |
| 40 | game_window = PongPongWindow(width=WIDTH, height=HEIGHT, caption="PongPong") |