]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - run.py
3 if getattr(sys
, 'frozen', False):
10 pygame
.mixer
.pre_init(frequency
= 44100)
13 size
= width
, height
= 1024, 600
15 screen
= pygame
.display
.set_mode(size
)
16 background
= pygame
.Surface(screen
.get_size())
17 background
= background
.convert()
18 background
.fill((250, 250, 250))
20 action_surface
= pygame
.Surface((600, 250)).convert()
21 action_surface
.fill((0,0,0))
22 helpers
.parse_config()
24 for key_name
in helpers
.Mapping
.KEYS
:
25 key
= helpers
.Mapping
.KEYS
[key_name
]
28 screen
.blit(background
, (0, 0))
29 screen
.blit(action_surface
, (10, 330))
40 event
= pygame
.event
.wait()
41 if event
.type == pygame
.QUIT
or (
42 event
.type == pygame
.KEYDOWN
and
44 event
.key
== pygame
.K_c
):
48 if context
== 'normal':
49 if event
.type == pygame
.KEYDOWN
:
50 key
= helpers
.Key
.find_by_key_num(event
.key
)
53 elif event
.type == pygame
.MOUSEBUTTONUP
:
54 key
= helpers
.Key
.find_by_collidepoint(pygame
.mouse
.get_pos())
56 key
.list_actions(action_surface
)