-
Notifications
You must be signed in to change notification settings - Fork 216
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (31 loc) · 797 Bytes
/
main.py
File metadata and controls
41 lines (31 loc) · 797 Bytes
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
import pygame
from game.game_engine import GameEngine
# Initialize pygame/Start application
pygame.init()
# Screen dimensions
WIDTH, HEIGHT = 800, 600
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Ping Pong - Pygame Version")
# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
# Clock
clock = pygame.time.Clock()
FPS = 60
# Game loop
engine = GameEngine(WIDTH, HEIGHT)
def main():
running = True
while running:
SCREEN.fill(BLACK)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
engine.handle_input()
engine.update()
engine.render(SCREEN)
pygame.display.flip()
clock.tick(FPS)
pygame.quit()
if __name__ == "__main__":
main()