comparison gamelib/mainmenu.py @ 346:6baf8b5beb5c

Remove the "constant" constant
author Neil Muller <drnlmuller@gmail.com>
date Sat, 05 Sep 2009 23:11:16 +0000
parents dd1ffee5ccf5
children 79fe97f8e8f5
comparison
equal deleted inserted replaced
345:279974cc0698 346:6baf8b5beb5c
20 pygame.display.set_caption(constants.NAME) 20 pygame.display.set_caption(constants.NAME)
21 splash = imagecache.load_image("images/splash.png") 21 splash = imagecache.load_image("images/splash.png")
22 pygame.display.get_surface().blit(splash, (0, 0)) 22 pygame.display.get_surface().blit(splash, (0, 0))
23 gui.Container.paint(self, s) 23 gui.Container.paint(self, s)
24 24
25 def get_mode(self):
26 return self.widgets[0].mode
27
25 class MainMenu(gui.Table): 28 class MainMenu(gui.Table):
26 def __init__(self, **params): 29 def __init__(self, **params):
27 gui.Table.__init__(self, **params) 30 gui.Table.__init__(self, **params)
31 self.mode = None
28 32
29 def fullscreen_toggled(): 33 def fullscreen_toggled():
30 pygame.display.toggle_fullscreen() 34 pygame.display.toggle_fullscreen()
31 35
32 def quit_pressed(): 36 def quit_pressed():
33 pygame.event.post(engine.QUIT) 37 pygame.event.post(engine.QUIT)
34 38
35 def start_game(mode): 39 def start_game(mode):
36 constants.TURN_LIMIT = constants.TURN_LIMITS[mode] 40 self.mode = mode
37 pygame.event.post(engine.START_DAY) 41 pygame.event.post(engine.START_DAY)
38 42
39 def help_pressed(): 43 def help_pressed():
40 pygame.event.post(engine.GO_HELP_SCREEN) 44 pygame.event.post(engine.GO_HELP_SCREEN)
41 45