diff gamelib/mainmenu.py @ 512:b112bcf4d435

Add restore game button to main menu.
author Simon Cross <hodgestar@gmail.com>
date Thu, 26 Nov 2009 23:36:20 +0000
parents 1e24eedbf40f
children 0667189a5973
line wrap: on
line diff
--- a/gamelib/mainmenu.py	Thu Nov 26 23:33:49 2009 +0000
+++ b/gamelib/mainmenu.py	Thu Nov 26 23:36:20 2009 +0000
@@ -5,6 +5,8 @@
 import constants
 import engine
 import imagecache
+import gameboard
+import savegame
 
 def make_main_menu(level):
     """Create a main menu"""
@@ -42,6 +44,9 @@
         def choose_level():
             pygame.event.post(engine.GO_LEVEL_SCREEN)
 
+        def load_game():
+            savegame.RestoreDialog(gameboard.GameBoard.restore_game).open()
+
         def help_pressed():
             pygame.event.post(engine.GO_HELP_SCREEN)
 
@@ -63,6 +68,11 @@
         self.tr()
         self.td(start_button, **td_kwargs)
 
+        loadgame_button = gui.Button('Restore Game')
+        loadgame_button.connect(gui.CLICK, load_game)
+        self.tr()
+        self.td(loadgame_button, **td_kwargs)
+
         quit_button = gui.Button("Quit")
         quit_button.connect(gui.CLICK, quit_pressed)