| 214 | |
| 215 | |
| 216 | class GameField: |
| 217 | def __init__(self, display_w: int, display_h: int, bg_color: str, line_color: tuple, caption: str) -> None: |
| 218 | self.disp_w = display_w |
| 219 | self.disp_h = display_h |
| 220 | self.screen = pygame.display.set_mode((display_w, display_h)) |
| 221 | self.bg_color = pygame.Color(bg_color) |
| 222 | self.caption = caption |
| 223 | self.line_color = line_color |
| 224 | pygame.display.set_caption(caption) |
| 225 | |
| 226 | def get_screen(self) -> pygame.Surface: |
| 227 | return self.screen |
| 228 | |
| 229 | def fill_screen(self): |
| 230 | self.screen.fill(self.bg_color) |
| 231 | |
| 232 | def draw_borders(self): |
| 233 | pygame.draw.aaline(self.screen, self.line_color, |
| 234 | (self.disp_w / 2, 0), (self.disp_w / 2, self.disp_h)) |
| 235 | |
| 236 | |
| 237 | class PongGame: |