]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - music_sampler.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 action_surface
= pygame
.Surface((600, 250)).convert()
17 action_surface
.fill((0,0,0))
18 helpers
.parse_config()
20 for key_name
in helpers
.Mapping
.KEYS
:
21 key
= helpers
.Mapping
.KEYS
[key_name
]
24 screen
.blit(background
, (0, 0))
25 screen
.blit(action_surface
, (10, 330))
36 event
= pygame
.event
.wait()
37 if event
.type == pygame
.QUIT
or (
38 event
.type == pygame
.KEYDOWN
and
40 event
.key
== pygame
.K_c
):
44 if context
== 'normal':
45 if event
.type == pygame
.KEYDOWN
:
46 key
= helpers
.Key
.find_by_key_num(event
.key
)
49 elif event
.type == pygame
.MOUSEBUTTONUP
:
50 key
= helpers
.Key
.find_by_collidepoint(pygame
.mouse
.get_pos())
52 key
.list_actions(action_surface
)