def init_menu(self): self.clear_screen() menu=Menu(("Play!","About","Help","Exit")) selection=-1 while True: events=pygame.event.get() selection=self.menu_action(events,menu) if selection >= 0: if selection == 0: break if selection == 1: menu.disp_about() if selection == 2: menu.disp_help() if selection == 3: sys.exit(0) globalvars.clock.tick(globalvars.FPS) self.clear_screen() pygame.mouse.set_visible(0) pygame.event.set_grab(1)
def exit_menu(self): self.clear_screen() pygame.mouse.set_visible(1) menu=Menu(("Again?","About","Help","Exit","Score: %s"%points.get_points())) selection=-1 while True: events=pygame.event.get() selection=self.menu_action(events,menu) if selection >= 0: if selection == 0: break if selection == 1: menu.disp_about() if selection == 2: menu.disp_help() if selection == 3: return False globalvars.clock.tick(globalvars.FPS) self.clear_screen() pygame.mouse.set_visible(0) return True