Esempio n. 1
0
    def setup_menu(self):
        y = 0
        heading_colour = Color('aquamarine')

        menu_group = UIGroup(0, 0, 'menu')
        heading = UIText('Path Finder', 0, 0, 'heading', 120, heading_colour)
        y += heading.get_height() + 20
        start = UIText('Start', 0, y, 'start_btn', 80)
        y += start.get_height() + 20
        help = UIText('Help', 0, y, 'help_btn', 80)
        y += help.get_height() + 20
        exit = UIText('Exit', 0, y, 'exit_btn', 80)

        menu_group.add_element(heading)

        for element in [start, help, exit]:
            element.x = center_element_x(element, heading.get_width()).x
            menu_group.add_element(element)

        width = pygame.display.get_surface().get_width()
        menu_group.set_position(center_element_x(heading, width).x, 80)

        self.add_element(menu_group)

        help_group = UIGroup(0, 0, 'help_screen')
        y = 0
        heading = UIText('Help', 0, 0, 'help_heading', 100, heading_colour)
        y += heading.get_height() + 20
        texts = [
            'Connect all of the terminal pairs to finish the level.',
            'R: Restart',
            'Esc: Return to the main menu.',
            'Right Click: Select and place terminal connectors.',
            'Left Click: Cancel the current line\'s construction.',
        ]
        help_group.add_element(heading)
        for text in texts:
            instruction = UIText(text, 0, y, '', 30)
            y += instruction.get_height() + 5
            help_group.add_element(instruction)

        help_group.set_position(50, 80)
        help_group.hide()
        self.add_element(help_group)
Esempio n. 2
0
    def setup_menu(self):
        y = 0
        heading_colour = Color('aquamarine')

        menu_group = UIGroup(0, 0, 'menu')
        heading = UIText('Path Finder', 0, 0, 'heading', 120, heading_colour)
        y += heading.get_height() + 20
        start = UIText('Start', 0, y, 'start_btn', 80)
        y += start.get_height() + 20
        help = UIText('Help', 0, y, 'help_btn', 80)
        y += help.get_height() + 20
        exit = UIText('Exit', 0, y, 'exit_btn', 80)

        menu_group.add_element(heading)

        for element in [start, help, exit]:
            element.x = center_element_x(element, heading.get_width()).x
            menu_group.add_element(element)

        width = pygame.display.get_surface().get_width()
        menu_group.set_position(center_element_x(heading, width).x, 80)

        self.add_element(menu_group)

        help_group = UIGroup(0, 0, 'help_screen')
        y = 0
        heading = UIText('Help', 0, 0, 'help_heading', 100, heading_colour)
        y += heading.get_height() + 20
        texts = [
            'Connect all of the terminal pairs to finish the level.',
            'R: Restart', 'Esc: Return to the main menu.',
            'Right Click: Select and place terminal connectors.',
            'Left Click: Cancel the current line\'s construction.',
        ]
        help_group.add_element(heading)
        for text in texts:
            instruction = UIText(text, 0, y, '', 30)
            y += instruction.get_height() + 5
            help_group.add_element(instruction)

        help_group.set_position(50, 80)
        help_group.hide()
        self.add_element(help_group)