Mercurial > rinkhals
comparison gamelib/main.py @ 389:463802281182
Add basic level support (level choosing needs work)
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Thu, 29 Oct 2009 20:55:37 +0000 |
parents | 4cc0b3627f83 |
children | 03d5cb669298 |
comparison
equal
deleted
inserted
replaced
388:c6f0e3e72e86 | 389:463802281182 |
---|---|
12 | 12 |
13 #from engine import Engine, MainMenuState | 13 #from engine import Engine, MainMenuState |
14 from sound import init_sound | 14 from sound import init_sound |
15 import constants | 15 import constants |
16 import data | 16 import data |
17 import sys | |
17 | 18 |
18 def create_main_app(screen): | 19 def create_main_app(screen): |
19 """Create an app with a background widget.""" | 20 """Create an app with a background widget.""" |
20 app = gui.App() | 21 app = gui.App() |
21 background = pygame.Surface(screen.get_size()) | 22 background = pygame.Surface(screen.get_size()) |
31 data.filepath('icons/foxassault24x24.png'))) | 32 data.filepath('icons/foxassault24x24.png'))) |
32 main_app = create_main_app(screen) | 33 main_app = create_main_app(screen) |
33 | 34 |
34 from engine import Engine, MainMenuState | 35 from engine import Engine, MainMenuState |
35 | 36 |
36 engine = Engine(main_app) | 37 if len(sys.argv) > 1: |
38 level_name = sys.argv[1] | |
39 else: | |
40 level_name = 'two_weeks' | |
41 | |
42 engine = Engine(main_app, level_name) | |
37 try: | 43 try: |
38 engine.run(MainMenuState(engine), screen) | 44 engine.run(MainMenuState(engine), screen) |
39 except KeyboardInterrupt: | 45 except KeyboardInterrupt: |
40 pass | 46 pass |