annotate pyntnclick/endscreen.py @ 587:f20d211d2c91 pyntnclick

load_image() -> get_image() and more docs.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 11 Feb 2012 17:02:26 +0200
parents cf65e91b30b1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
443
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
1 # endscreen.py
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
2 # Copyright Boomslang team, 2010 (see COPYING File)
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
3 # Victory screen for the game
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
4
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
5 from albow.screen import Screen
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
6
551
38fb04728ac5 Rearrange import.
Jeremy Thurgood <firxen@gmail.com>
parents: 548
diff changeset
7 from pyntnclick.widgets import BoomImageButton
450
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
8
530
fe51223e0c8d PEP8 cleanup data.py and endscreen.py
Neil Muller <neil@dip.sun.ac.za>
parents: 528
diff changeset
9
450
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
10 class EndImageButton(BoomImageButton):
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
11
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
12 FOLDER = 'won'
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
13
443
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
14
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
15 class EndScreen(Screen):
581
7e4a20eb78b8 Pass game_description to all screens
Stefano Rivera <stefano@rivera.za.net>
parents: 551
diff changeset
16 def __init__(self, shell, game_description):
443
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
17 Screen.__init__(self, shell)
587
f20d211d2c91 load_image() -> get_image() and more docs.
Jeremy Thurgood <firxen@gmail.com>
parents: 586
diff changeset
18 self.background = game_description.resource.get_image(
586
cf65e91b30b1 Use load_image where possible
Stefano Rivera <stefano@rivera.za.net>
parents: 581
diff changeset
19 ('won', 'won.png'))
530
fe51223e0c8d PEP8 cleanup data.py and endscreen.py
Neil Muller <neil@dip.sun.ac.za>
parents: 528
diff changeset
20 self._menu_button = EndImageButton('menu.png', 26, 500,
fe51223e0c8d PEP8 cleanup data.py and endscreen.py
Neil Muller <neil@dip.sun.ac.za>
parents: 528
diff changeset
21 action=self.main_menu)
fe51223e0c8d PEP8 cleanup data.py and endscreen.py
Neil Muller <neil@dip.sun.ac.za>
parents: 528
diff changeset
22 self._quit_button = EndImageButton('quit.png', 250, 500,
fe51223e0c8d PEP8 cleanup data.py and endscreen.py
Neil Muller <neil@dip.sun.ac.za>
parents: 528
diff changeset
23 action=shell.quit)
450
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
24 self.add(self._menu_button)
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
25 self.add(self._quit_button)
443
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
26
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
27 def draw(self, surface):
476
c72946d3a59a Some minor pylint driven style fixes
Neil Muller <neil@dip.sun.ac.za>
parents: 450
diff changeset
28 surface.blit(self.background, (0, 0))
450
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
29 self._menu_button.draw(surface)
ece69836f00a Image buttons for game over screen
Neil Muller <neil@dip.sun.ac.za>
parents: 443
diff changeset
30 self._quit_button.draw(surface)
443
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
31
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
32 def main_menu(self):
3dab4984cbd7 Redo way of reaching end screen
Neil Muller <neil@dip.sun.ac.za>
parents:
diff changeset
33 self.shell.show_screen(self.shell.menu_screen)