Mercurial > boomslang
comparison pyntnclick/main.py @ 581:7e4a20eb78b8 pyntnclick
Pass game_description to all screens
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 11 Feb 2012 16:28:41 +0200 |
parents | 27809609eeca |
children | f20d211d2c91 |
comparison
equal
deleted
inserted
replaced
580:27809609eeca | 581:7e4a20eb78b8 |
---|---|
24 from pyntnclick.sound import Sound | 24 from pyntnclick.sound import Sound |
25 from pyntnclick import state | 25 from pyntnclick import state |
26 | 26 |
27 | 27 |
28 class MainShell(Shell): | 28 class MainShell(Shell): |
29 def __init__(self, display, initial_state, frame_rate): | 29 def __init__(self, display, game_description): |
30 Shell.__init__(self, display) | 30 Shell.__init__(self, display) |
31 self.menu_screen = MenuScreen(self) | 31 self.menu_screen = MenuScreen(self, game_description) |
32 self.game_screen = GameScreen(self, initial_state) | 32 self.game_screen = GameScreen(self, game_description) |
33 self.end_screen = EndScreen(self) | 33 self.end_screen = EndScreen(self, game_description) |
34 self.set_timer(frame_rate) | 34 self.set_timer(game_description.constants.frame_rate) |
35 self.show_screen(self.menu_screen) | 35 self.show_screen(self.menu_screen) |
36 | 36 |
37 | 37 |
38 class GameDescriptionError(Exception): | 38 class GameDescriptionError(Exception): |
39 """Raised when an GameDescription is invalid.""" | 39 """Raised when an GameDescription is invalid.""" |
105 display = pygame.display.set_mode(self.constants.screen, | 105 display = pygame.display.set_mode(self.constants.screen, |
106 SWSURFACE) | 106 SWSURFACE) |
107 pygame.display.set_icon(self.resource.load_image( | 107 pygame.display.set_icon(self.resource.load_image( |
108 'suspended_sentence24x24.png', basedir='icons')) | 108 'suspended_sentence24x24.png', basedir='icons')) |
109 pygame.display.set_caption("Suspended Sentence") | 109 pygame.display.set_caption("Suspended Sentence") |
110 shell = MainShell(display, self.initial_state, | 110 shell = MainShell(display, self) |
111 self.constants.frame_rate) | |
112 try: | 111 try: |
113 shell.run() | 112 shell.run() |
114 except KeyboardInterrupt: | 113 except KeyboardInterrupt: |
115 pass | 114 pass |