Mercurial > boomslang
annotate gamelib/menu.py @ 443:3dab4984cbd7
Redo way of reaching end screen
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sun, 29 Aug 2010 00:24:40 +0200 |
parents | 97322b78d1c1 |
children | a6de33fecb97 |
rev | line source |
---|---|
17 | 1 # menu.py |
2 # Copyright Boomslang team, 2010 (see COPYING File) | |
3 # Main menu for the game | |
4 | |
5 from albow.screen import Screen | |
6 from albow.controls import Button, Label | |
7 from albow.layout import Column | |
8 | |
124 | 9 |
84
c76f2fad2af5
Draw CursorWidget on top of StateWidget
Stefano Rivera <stefano@rivera.za.net>
parents:
66
diff
changeset
|
10 class MenuScreen(Screen): |
19 | 11 def __init__(self, shell): |
84
c76f2fad2af5
Draw CursorWidget on top of StateWidget
Stefano Rivera <stefano@rivera.za.net>
parents:
66
diff
changeset
|
12 Screen.__init__(self, shell) |
24
9d5de13e2ac3
Add a game screen. So far, the game content looks a *lot* like the main menu.
Jeremy Thurgood <firxen@gmail.com>
parents:
19
diff
changeset
|
13 StartButton = Button('Start New Game', action = self.start) |
100
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
14 ResumeButton = Button('Resume Game', action = self.resume, |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
15 enable=self.check_running) |
19 | 16 QuitButton = Button('Quit', action = shell.quit) |
50 | 17 Title = Label('Suspended Sentence') |
19 | 18 menu = Column([ |
19 Title, | |
20 StartButton, | |
100
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
21 ResumeButton, |
19 | 22 QuitButton, |
23 ], align='l', spacing=20) | |
24 self.add_centered(menu) | |
17 | 25 |
19 | 26 def start(self): |
100
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
27 self.shell.game_screen.start_game() |
24
9d5de13e2ac3
Add a game screen. So far, the game content looks a *lot* like the main menu.
Jeremy Thurgood <firxen@gmail.com>
parents:
19
diff
changeset
|
28 self.shell.show_screen(self.shell.game_screen) |
17 | 29 |
100
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
30 def check_running(self): |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
31 return self.shell.game_screen.running |
17 | 32 |
100
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
33 def resume(self): |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
34 if self.shell.game_screen.running: |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
35 self.shell.show_screen(self.shell.game_screen) |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
36 |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
37 |
b5b6cbf556e6
Make start new game start a new game. Add Resume to main menu
Neil Muller <neil@dip.sun.ac.za>
parents:
84
diff
changeset
|
38 |