Mercurial > boomslang
comparison gamelib/menu.py @ 100:b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Tue, 24 Aug 2010 08:48:50 +0200 |
parents | c76f2fad2af5 |
children | 97322b78d1c1 |
comparison
equal
deleted
inserted
replaced
99:367b1c9c3c6d | 100:b5b6cbf556e6 |
---|---|
8 | 8 |
9 class MenuScreen(Screen): | 9 class MenuScreen(Screen): |
10 def __init__(self, shell): | 10 def __init__(self, shell): |
11 Screen.__init__(self, shell) | 11 Screen.__init__(self, shell) |
12 StartButton = Button('Start New Game', action = self.start) | 12 StartButton = Button('Start New Game', action = self.start) |
13 ResumeButton = Button('Resume Game', action = self.resume, | |
14 enable=self.check_running) | |
13 QuitButton = Button('Quit', action = shell.quit) | 15 QuitButton = Button('Quit', action = shell.quit) |
14 Title = Label('Suspended Sentence') | 16 Title = Label('Suspended Sentence') |
15 menu = Column([ | 17 menu = Column([ |
16 Title, | 18 Title, |
17 StartButton, | 19 StartButton, |
20 ResumeButton, | |
18 QuitButton, | 21 QuitButton, |
19 ], align='l', spacing=20) | 22 ], align='l', spacing=20) |
20 self.add_centered(menu) | 23 self.add_centered(menu) |
21 | 24 |
22 def start(self): | 25 def start(self): |
23 print 'Starting the game' | 26 self.shell.game_screen.start_game() |
24 self.shell.show_screen(self.shell.game_screen) | 27 self.shell.show_screen(self.shell.game_screen) |
25 | 28 |
29 def check_running(self): | |
30 return self.shell.game_screen.running | |
26 | 31 |
32 def resume(self): | |
33 if self.shell.game_screen.running: | |
34 self.shell.show_screen(self.shell.game_screen) | |
35 | |
36 | |
37 |