aboutsummaryrefslogtreecommitdiff
path: root/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'run.py')
-rw-r--r--run.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/run.py b/run.py
new file mode 100644
index 0000000..88afaad
--- /dev/null
+++ b/run.py
@@ -0,0 +1,45 @@
1import pygame
2import sys
3import helpers
4
5pygame.init()
6
7size = width, height = 1024, 600
8
9screen = pygame.display.set_mode(size)
10background = pygame.Surface(screen.get_size())
11background = background.convert()
12background.fill((250, 250, 250))
13
14for key_name in helpers.keys:
15 key = helpers.keys[key_name]
16 key.draw(background)
17
18screen.blit(background, (0, 0))
19pygame.display.flip()
20
21contexts = [
22 'normal'
23]
24
25context = 'normal'
26
27while 1:
28 event = pygame.event.wait()
29 if event.type == pygame.QUIT or (
30 event.type == pygame.KEYDOWN and
31 event.mod == 4160 and
32 event.key == pygame.K_c):
33 pygame.quit()
34 sys.exit()
35
36 if context == 'normal':
37 if event.type == pygame.KEYDOWN and event.key in helpers.keys:
38 helpers.keys[event.key].do_actions()
39 if event.type == pygame.MOUSEBUTTONUP:
40 for key in helpers.keys:
41 if helpers.keys[key].collidepoint(pygame.mouse.get_pos()):
42 helpers.keys[key].do_actions()
43
44 pygame.display.flip()
45