Mercurial > boomslang
comparison gamelib/main.py @ 532:02cf5537d74e
PEP-8 main.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 11 Feb 2012 11:59:21 +0200 |
parents | 9c285017535d |
children | f95830b58336 |
comparison
equal
deleted
inserted
replaced
531:60c345d19daf | 532:02cf5537d74e |
---|---|
17 from albow.shell import Shell | 17 from albow.shell import Shell |
18 | 18 |
19 from menu import MenuScreen | 19 from menu import MenuScreen |
20 from gamescreen import GameScreen | 20 from gamescreen import GameScreen |
21 from endscreen import EndScreen | 21 from endscreen import EndScreen |
22 from constants import SCREEN, FRAME_RATE, FREQ, BITSIZE, CHANNELS, BUFFER, DEBUG | 22 from constants import ( |
23 SCREEN, FRAME_RATE, FREQ, BITSIZE, CHANNELS, BUFFER, DEBUG) | |
23 from sound import no_sound, disable_sound | 24 from sound import no_sound, disable_sound |
24 import state | 25 import state |
25 import data | 26 import data |
27 | |
26 | 28 |
27 def parse_args(args): | 29 def parse_args(args): |
28 parser = OptionParser() | 30 parser = OptionParser() |
29 parser.add_option("--no-sound", action="store_false", default=True, | 31 parser.add_option("--no-sound", action="store_false", default=True, |
30 dest="sound", help="disable sound") | 32 dest="sound", help="disable sound") |
44 self.game_screen = GameScreen(self) | 46 self.game_screen = GameScreen(self) |
45 self.end_screen = EndScreen(self) | 47 self.end_screen = EndScreen(self) |
46 self.set_timer(FRAME_RATE) | 48 self.set_timer(FRAME_RATE) |
47 self.show_screen(self.menu_screen) | 49 self.show_screen(self.menu_screen) |
48 | 50 |
51 | |
49 def main(): | 52 def main(): |
50 opts = parse_args(sys.argv) | 53 opts = parse_args(sys.argv) |
51 pygame.display.init() | 54 pygame.display.init() |
52 pygame.font.init() | 55 pygame.font.init() |
53 if opts.sound: | 56 if opts.sound: |
61 if DEBUG: | 64 if DEBUG: |
62 if opts.scene is not None: | 65 if opts.scene is not None: |
63 # debug the specified scene | 66 # debug the specified scene |
64 state.DEBUG_SCENE = opts.scene | 67 state.DEBUG_SCENE = opts.scene |
65 state.DEBUG_RECTS = opts.rects | 68 state.DEBUG_RECTS = opts.rects |
66 display = pygame.display.set_mode(SCREEN, SWSURFACE) | 69 display = pygame.display.set_mode(SCREEN, SWSURFACE) |
67 pygame.display.set_icon(pygame.image.load( | 70 pygame.display.set_icon(pygame.image.load( |
68 data.filepath('icons/suspended_sentence24x24.png'))) | 71 data.filepath('icons/suspended_sentence24x24.png'))) |
69 pygame.display.set_caption("Suspended Sentence") | 72 pygame.display.set_caption("Suspended Sentence") |
70 shell = MainShell(display) | 73 shell = MainShell(display) |
71 try: | 74 try: |
72 shell.run() | 75 shell.run() |
73 except KeyboardInterrupt: | 76 except KeyboardInterrupt: |
74 pass | 77 pass |
75 |