def __init__(self): super( MainMenu, self).__init__('LUCA') #self.select_sound = soundex.load('move.mp3') # you can override the font that will be used for the title and the items # you can also override the font size and the colors. see menu.py for # more info #self.font_title['font_name'] = 'Edit Undo Line BRK' self.font_title['font_size'] = 72 self.font_title['color'] = colors.rgba(colors.base03) self.font_item['font_name'] = 'Edit Undo Line BRK', self.font_item['color'] = colors.rgba(colors.base03) self.font_item['font_size'] = 32 self.font_item_selected['font_name'] = 'Edit Undo Line BRK' self.font_item_selected['color'] = colors.rgba(colors.color[random.randint(0,7)]) self.font_item_selected['font_size'] = 46 # example: menus can be vertical aligned and horizontal aligned self.menu_anchor_y = menu.CENTER self.menu_anchor_x = menu.CENTER items = [] items.append( menu.MenuItem('New Game', self.on_new_game) ) #items.append( MenuItem('Options', self.on_options) ) #items.append( MenuItem('Scores', self.on_scores) ) items.append( menu.MenuItem('Quit', self.on_quit) ) self.create_menu( items, menu.shake(), menu.shake_back() )
def __init__(self): menu.Menu.__init__(self, 'Paused') items = [ menu.MenuItem('Resume game', self.on_resume), menu.MenuItem('Leave race', director.pop) ] self.create_menu(items, menu.shake(), menu.shake_back())
def __init__(self): """Creates the main menu for the game.""" super(self.__class__, self).__init__('Tank Battle') items = [ menu.MenuItem('New Game', self.on_new_game), menu.MenuItem('Options', self.on_options), menu.MenuItem('Quit', self.on_quit_button) ] self.create_menu(items, menu.shake(), menu.shake_back())
def __init__(self): super(ResultsMenu, self).__init__('Results') if state.cup.has_next_track(): items = [ menu.MenuItem('Next race', self.on_next_race), menu.MenuItem('Back to Main Menu', self.on_back) ] else: items = [menu.MenuItem('Proceed', self.on_proceed)] self.create_menu(items, menu.shake(), menu.shake_back())
def __init__(self, controller): super().__init__('Options') self.ctrl = controller set_menu_style(self) items = [ menu.ToggleMenuItem('Show FPS:', self.on_show_fps, director.show_FPS), menu.MenuItem('FullScreen', self.on_full_screen), menu.MenuItem('Back', self.on_quit) ] self.create_menu( items, selected_effect=menu.shake(), unselected_effect=menu.shake_back(), )
def __init__(self): """Initializes the new game menu.""" super(self.__class__, self).__init__('New Game') items = [ menu.EntryMenuItem('Server:', self.on_server_text, ''), menu.MenuItem('Start', self.on_start) ] self.create_menu(items, menu.shake(), menu.shake_back())
def __init__(self, controller): super().__init__('HearthStone') self.ctrl = controller set_menu_style(self) # [NOTE] Menu can only contain items, it cannot contain other child, such as Label. # Menu items items = [ menu.MenuItem('New Game', self.on_new_game), menu.MenuItem('Deck', self.on_deck), menu.MenuItem('Options', self.on_options), menu.MenuItem('Exit', self.on_quit), ] self.create_menu( items, selected_effect=menu.shake(), unselected_effect=menu.shake_back(), # activated_effect=actions.ScaleTo(1.15, duration=0.2), )
def __init__(self, controller): super().__init__('Options') self.ctrl = controller set_menu_style(self) items = [ menu.ToggleMenuItem('Show FPS:', self.on_show_fps, director.director.show_FPS), menu.ToggleMenuItem('FullScreen:', self.on_full_screen, director.director.window.fullscreen), menu.ToggleMenuItem('Run Animations:', self.on_run_animations, C.UI.Cocos.RunAnimations), menu.MenuItem('Back', self.on_quit) ] self.create_menu(items) # From which scene to this layer? self.where_come_from = None
def __init__(self, controller): super().__init__('HearthStone') self.ctrl = controller set_menu_style(self) # [NOTE] Menu can only contain items, it cannot contain other child, such as Label. # Menu items items = [ menu.MenuItem('New Game', self.on_new_game), menu.MenuItem('New Adventure', self.on_new_adventure), menu.MenuItem('Start Server', self.on_start_server), menu.MenuItem('Join Server', self.on_join_server), menu.MenuItem('Deck', self.on_collections), menu.MenuItem('Options', self.on_options), menu.MenuItem('Exit', self.on_quit), ] self.create_menu(items)
def __init__(self, controller): super().__init__('Deck') self.ctrl = controller set_menu_style(self, item_size=24) window_size = director.get_window_size() items = [ menu.MenuItem('Back', self.on_quit), ] items_positions = [ abs_pos(0.95, 0.05, window_size), ] self.create_menu( items, selected_effect=menu.shake(), unselected_effect=menu.shake_back(), layout_strategy=menu.fixedPositionMenuLayout(items_positions), )
def create(self, **kw): menu_items = [] seq = ("Play", "Quit") for k in seq: menu_items.append(ccmn.MenuItem(k, kw[k])) self.create_menu(menu_items, ccmn.shake(), ccmn.shake_back())