Mercurial > pyntnclick
comparison gamelib/endscreen.py @ 450:ece69836f00a
Image buttons for game over screen
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sun, 29 Aug 2010 00:50:25 +0200 |
parents | 3dab4984cbd7 |
children | c72946d3a59a |
comparison
equal
deleted
inserted
replaced
449:a30f91ee5b33 | 450:ece69836f00a |
---|---|
5 from albow.screen import Screen | 5 from albow.screen import Screen |
6 from albow.controls import Button | 6 from albow.controls import Button |
7 from albow.resource import get_image | 7 from albow.resource import get_image |
8 from albow.layout import Column | 8 from albow.layout import Column |
9 | 9 |
10 from gamelib.widgets import BoomImageButton | |
11 | |
12 class EndImageButton(BoomImageButton): | |
13 | |
14 FOLDER = 'won' | |
15 | |
10 | 16 |
11 class EndScreen(Screen): | 17 class EndScreen(Screen): |
12 def __init__(self, shell): | 18 def __init__(self, shell): |
13 Screen.__init__(self, shell) | 19 Screen.__init__(self, shell) |
14 self.background = get_image('won', 'won.png') | 20 self.background = get_image('won', 'won.png') |
15 StartButton = Button('Main Menu', action = self.main_menu) | 21 self._menu_button = EndImageButton('menu.png', 26, 500, action=self.main_menu) |
16 QuitButton = Button('Quit', action = shell.quit) | 22 self._quit_button = EndImageButton('quit.png', 250, 500, action=shell.quit) |
17 self.add(StartButton) | 23 self.add(self._menu_button) |
18 StartButton.rect.bottomleft = (50, 550) | 24 self.add(self._quit_button) |
19 self.add(QuitButton) | |
20 QuitButton.rect.bottomleft = (250, 550) | |
21 | 25 |
22 def draw(self, surface): | 26 def draw(self, surface): |
23 surface.blit(self.background, (0,0)) | 27 surface.blit(self.background, (0,0)) |
24 super(EndScreen, self).draw(surface) | 28 self._menu_button.draw(surface) |
29 self._quit_button.draw(surface) | |
25 | 30 |
26 def main_menu(self): | 31 def main_menu(self): |
27 self.shell.show_screen(self.shell.menu_screen) | 32 self.shell.show_screen(self.shell.menu_screen) |
28 | 33 |
29 | 34 |