Mercurial > sypikslang
comparison gamelib/main.py @ 232:75033f790e7d
Remove hooks for sound support - we can add them back easily enough later
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 12 May 2012 23:37:24 +0200 |
parents | 80cce62f29fb |
children |
comparison
equal
deleted
inserted
replaced
231:57981202bfa5 | 232:75033f790e7d |
---|---|
11 | 11 |
12 from gamelib.engine import Engine | 12 from gamelib.engine import Engine |
13 from gamelib.data import load_image | 13 from gamelib.data import load_image |
14 from gamelib.mainmenu import MainMenu | 14 from gamelib.mainmenu import MainMenu |
15 | 15 |
16 from gamelib.constants import (SCREEN, FREQ, BITSIZE, CHANNELS, BUFFER, | 16 from gamelib.constants import SCREEN, WINDOW_ICON |
17 WINDOW_ICON) | |
18 | 17 |
19 | 18 |
20 def parse_args(args): | 19 def parse_args(args): |
21 parser = optparse.OptionParser() | 20 parser = optparse.OptionParser() |
22 | |
23 parser.add_option('--no-sound', action="store_false", default=True, | |
24 dest="sound", help="disable sound") | |
25 | 21 |
26 parser.add_option('--load', type="string", default=None, | 22 parser.add_option('--load', type="string", default=None, |
27 dest="load", help="Save game to load") | 23 dest="load", help="Save game to load") |
28 | 24 |
29 return parser.parse_args(args) | 25 return parser.parse_args(args) |
31 | 27 |
32 def main(): | 28 def main(): |
33 opts, args = parse_args(sys.argv) | 29 opts, args = parse_args(sys.argv) |
34 pygame.display.init() | 30 pygame.display.init() |
35 pygame.font.init() | 31 pygame.font.init() |
36 if opts.sound: | |
37 pygame.mixer.init(FREQ, BITSIZE, CHANNELS, BUFFER) | |
38 screen = pygame.display.set_mode(SCREEN) | 32 screen = pygame.display.set_mode(SCREEN) |
39 pygame.display.set_icon(load_image(WINDOW_ICON)) | 33 pygame.display.set_icon(load_image(WINDOW_ICON)) |
40 engine = Engine(screen) | 34 engine = Engine(screen) |
41 window = MainMenu(screen, opts.load) | 35 window = MainMenu(screen, opts.load) |
42 engine.run(window) | 36 engine.run(window) |