Mercurial > boomslang
diff gamelib/endscreen.py @ 599:2d2ea51b73ad pyntnclick
Move menu.py and endscreen.py to gamelib. Add default versions for new games
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sat, 11 Feb 2012 18:46:19 +0200 |
parents | pyntnclick/endscreen.py@f20d211d2c91 |
children | f2b1ddcc4986 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamelib/endscreen.py Sat Feb 11 18:46:19 2012 +0200 @@ -0,0 +1,33 @@ +# endscreen.py +# Copyright Boomslang team, 2010 (see COPYING File) +# Victory screen for the game + +from albow.screen import Screen + +from pyntnclick.widgets import BoomImageButton + + +class EndImageButton(BoomImageButton): + + FOLDER = 'won' + + +class EndScreen(Screen): + def __init__(self, shell, game_description): + Screen.__init__(self, shell) + self.background = game_description.resource.get_image( + ('won', 'won.png')) + self._menu_button = EndImageButton('menu.png', 26, 500, + action=self.main_menu) + self._quit_button = EndImageButton('quit.png', 250, 500, + action=shell.quit) + self.add(self._menu_button) + self.add(self._quit_button) + + def draw(self, surface): + surface.blit(self.background, (0, 0)) + self._menu_button.draw(surface) + self._quit_button.draw(surface) + + def main_menu(self): + self.shell.show_screen(self.shell.menu_screen)