documentation index ◦ reference manual ◦ function index

# layout.imagemap_main_menu

Function: | layout.imagemap_main_menu | (ground, selected, hotspots, idle=None, variant=None):

ground - The ground image. This is used for parts of the screen that are not defined.

selected - The selected image. This used for hotspots that are hovered.

hotspots - A list of tuples defining the hotspot. Each tuple consists of:

1. The x-coordinate of the left side.
2. The y-coordinate of the top side.
3. The x-coordinate of the right side.
4. The y-coordinate of the bottom side.
5. Either the (untranslated) name of the main menu button this hotspot is equivalent to, or, a label in the program to jump to when this hotspot is clicked.

idle - If not None, an image that is used for images that are not hovered. If this is None, it defaults to ground. (new in 6.10.1)

variant - The variant of the main menu to define. The variable _main_menu_variant is used to select a variant to show to the user. (new in 6.10.1)

Despite the name, this function can take arbitrary displayables (like Animations) as well as images.

## Example

    init -2 python:
        layout.imagemap_main_menu("menu2.jpg", "menu1.jpg", [
            (111, 248, 392 ,313, "Start Game"),
            (111, 313, 392, 378, "Load Game"),
            (48, 432, 237, 529, "Preferences"),
            (48,529,237,576, "Quit"),
            (48, 435, 237, 482, "instructions"),
            ])

Here's an example that shows how main menu variants can work.

    init -2 python:

        layout.imagemap_main_menu(
            "gui_set_a/gui_main_menu_a.png",
            "gui_set_a/gui_main_menu_b.png",
            [ (613, 107, 776, 190, "Start Game"),
              (613, 207, 776, 291, "Load Game"),
              (613, 307, 776, 391, "Preferences"),
              (613, 408, 776, 492, "Quit") ],
            variant = 'locked'
            )

        layout.imagemap_main_menu(
            "gui_set_b/gui_main_menu_a.png",
            "gui_set_b/gui_main_menu_b.png" ,
            [
                (646, 108, 777, 174, "Start Game"),
                (646, 188, 777, 254, "Load Game"),
                (646, 267, 777, 334, "Preferences"),
                (646, 347, 777, 415, "extras"),
                (646, 427, 777, 492, "Quit"),
                ],
            variant = 'unlocked'
            )

    label main_menu:

        if persistent.extra_unlocked:
            $ _main_menu_variant = 'unlocked'
        else:
            $ _main_menu_variant = 'locked'

        jump main_menu_screen

documentation index ◦ reference manual ◦ function index