]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - run.py
6 pygame
.mixer
.pre_init(frequency
= 44100)
9 size
= width
, height
= 1024, 600
11 screen
= pygame
.display
.set_mode(size
)
12 background
= pygame
.Surface(screen
.get_size())
13 background
= background
.convert()
14 background
.fill((250, 250, 250))
16 helpers
.parse_config()
18 for key_name
in helpers
.Mapping
.KEYS
:
19 key
= helpers
.Mapping
.KEYS
[key_name
]
22 screen
.blit(background
, (0, 0))
32 event
= pygame
.event
.wait()
33 if event
.type == pygame
.QUIT
or (
34 event
.type == pygame
.KEYDOWN
and
36 event
.key
== pygame
.K_c
):
40 if context
== 'normal':
41 if event
.type == pygame
.KEYDOWN
and event
.key
in helpers
.Mapping
.KEYS
:
42 helpers
.Mapping
.KEYS
[event
.key
].do_actions()
43 if event
.type == pygame
.MOUSEBUTTONUP
:
44 for key
in helpers
.Mapping
.KEYS
:
45 if helpers
.Mapping
.KEYS
[key
].collidepoint(pygame
.mouse
.get_pos()):
46 helpers
.Mapping
.KEYS
[key
].do_actions()