aboutsummaryrefslogtreecommitdiff
path: root/run.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-06-15 09:53:06 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-06-15 09:53:06 +0200
commit532454ebada0ca776e8136450ed8810bc22d210b (patch)
tree571f6b8b4414797c86f5bf3847a1ebf0fe35ed2f /run.py
parentd8ab67c745b78d0b2f5896cf6642004b3951433c (diff)
downloadMusicSampler-532454ebada0ca776e8136450ed8810bc22d210b.tar.gz
MusicSampler-532454ebada0ca776e8136450ed8810bc22d210b.tar.zst
MusicSampler-532454ebada0ca776e8136450ed8810bc22d210b.zip
Move files
Diffstat (limited to 'run.py')
-rw-r--r--run.py59
1 files changed, 0 insertions, 59 deletions
diff --git a/run.py b/run.py
deleted file mode 100644
index 9797c91..0000000
--- a/run.py
+++ /dev/null
@@ -1,59 +0,0 @@
1import sys
2
3if getattr(sys, 'frozen', False):
4 os.chdir(sys._MEIPASS)
5
6import pygame
7import pydub
8import helpers
9
10pygame.mixer.pre_init(frequency = 44100)
11pygame.init()
12
13size = width, height = 1024, 600
14
15screen = pygame.display.set_mode(size)
16background = pygame.Surface(screen.get_size())
17background = background.convert()
18background.fill((250, 250, 250))
19
20action_surface = pygame.Surface((600, 250)).convert()
21action_surface.fill((0,0,0))
22helpers.parse_config()
23
24for key_name in helpers.Mapping.KEYS:
25 key = helpers.Mapping.KEYS[key_name]
26 key.draw(background)
27
28screen.blit(background, (0, 0))
29screen.blit(action_surface, (10, 330))
30
31pygame.display.flip()
32
33contexts = [
34 'normal'
35]
36
37context = 'normal'
38
39while 1:
40 event = pygame.event.wait()
41 if event.type == pygame.QUIT or (
42 event.type == pygame.KEYDOWN and
43 event.mod == 4160 and
44 event.key == pygame.K_c):
45 pygame.quit()
46 sys.exit()
47
48 if context == 'normal':
49 if event.type == pygame.KEYDOWN:
50 key = helpers.Key.find_by_key_num(event.key)
51 if key is not None:
52 key.do_actions()
53 elif event.type == pygame.MOUSEBUTTONUP:
54 key = helpers.Key.find_by_collidepoint(pygame.mouse.get_pos())
55 if key is not None:
56 key.list_actions(action_surface)
57
58 pygame.display.flip()
59