Show
Ignore:
Timestamp:
12/25/06 16:21:01 (5 years ago)
Author:
mg
Message:

Allow players to access Help and Options during the game from the menu you
get by pressing Esc.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/pyspacewar/ui.py

    r221 r222  
    9393    a dual-monitor setup, the dual-head virtual mode (2048x768) appears as 
    9494    the largest video mode returned by list_modes.  However it does not work 
    95     at all as a full-screen mode, and looks weird when windowed.. 
     95    at all as a full-screen mode, and looks weird when windowed. 
    9696    """ 
    9797    return bool(w / h < 2) 
     
    911911    mouse_visible = False 
    912912 
     913    inherit_pause_from_prev_mode = False 
     914 
    913915    def __init__(self, ui): 
    914916        self.ui = ui 
     
    926928            # Only do this once, otherwise two modes might get in a loop 
    927929            self.prev_mode = prev_mode 
     930            if self.inherit_pause_from_prev_mode and prev_mode is not None: 
     931                self.paused = prev_mode.paused 
    928932        pygame.mouse.set_visible(self.mouse_visible) 
    929933 
     
    10591063 
    10601064    mouse_visible = True 
     1065    inherit_pause_from_prev_mode = True 
    10611066 
    10621067    def init(self): 
     
    11531158    """Mode: main menu.""" 
    11541159 
    1155     paused = False 
    1156  
    11571160    def init_menu(self): 
    11581161        """Initialize the mode.""" 
     
    11731176    """Mode: new game menu.""" 
    11741177 
    1175     paused = False 
    1176  
    11771178    def init_menu(self): 
    11781179        """Initialize the mode.""" 
     
    11871188class OptionsMenuMode(MenuMode): 
    11881189    """Mode: options menu.""" 
    1189  
    1190     paused = False 
    11911190 
    11921191    def init_menu(self): 
     
    12321231    """Mode: screen resolution menu.""" 
    12331232 
    1234     paused = False 
    1235  
    12361233    def init_menu(self): 
    12371234        """Initialize the mode.""" 
     
    12541251 
    12551252    paused = True 
     1253    inherit_pause_from_prev_mode = False 
    12561254 
    12571255    def init_menu(self): 
     
    12591257        self.menu_items = [ 
    12601258            ('Resume game',     self.close_menu), 
     1259            ('Options',         self.ui.options_menu), 
     1260            ('Help',            self.ui.help), 
    12611261            ('End Game',        self.ui.end_game), 
    12621262        ]