Mercurial > pyntnclick
diff gamelib/main.py @ 176:c6ea3b11514c
Add --scene for selecting initial scene during debugging.
author | Simon Cross <simon@simonx> |
---|---|
date | Wed, 25 Aug 2010 13:56:38 +0200 |
parents | 7f6b11a0d404 |
children | 3cedc4f95925 |
line wrap: on
line diff
--- a/gamelib/main.py Wed Aug 25 13:55:20 2010 +0200 +++ b/gamelib/main.py Wed Aug 25 13:56:38 2010 +0200 @@ -19,13 +19,17 @@ from menu import MenuScreen from gamescreen import GameScreen -from constants import SCREEN, FRAME_RATE, FREQ, BITSIZE, CHANNELS, BUFFER +from constants import SCREEN, FRAME_RATE, FREQ, BITSIZE, CHANNELS, BUFFER, DEBUG from sound import no_sound, disable_sound +import state def parse_args(args): parser = OptionParser() parser.add_option("--no-sound", action="store_false", default=True, dest="sound", help="disable sound") + if DEBUG: + parser.add_option("--scene", type="str", default=None, + dest="scene", help="initial scene") opts, _ = parser.parse_args(args or []) return opts @@ -50,6 +54,9 @@ else: # Ensure get_sound returns nothing, so everything else just works disable_sound() + if DEBUG and opts.scene is not None: + # debug the specified scene + state.DEBUG_SCENE = opts.scene display = pygame.display.set_mode(SCREEN, SWSURFACE) shell = MainShell(display) try: