-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
44 lines (29 loc) · 984 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
36
37
38
39
40
41
42
43
44
import pygame
from gfs.surface import Surface, flip, events
from gfs.music import Music
from game import Game
def main():
surface = Surface(1280, 720, "Game jam!")
clock = pygame.time.Clock()
game = Game(surface.width, surface.height)
is_running = True
timer = 0
while is_running:
for event in events():
if event.type == pygame.QUIT:
is_running = False
elif event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
game.keyboard_input(event)
elif event.type == pygame.MOUSEBUTTONDOWN or event.type == pygame.MOUSEBUTTONUP:
game.mouse_input(event)
elif event.type == pygame.MOUSEMOTION:
game.mouse_motion(event)
game.update()
surface.clear((0, 0, 0))
game.render(surface)
flip()
clock.tick(60)
timer = (timer + 1) % 60
pygame.quit()
if __name__ == "__main__":
main()